In emacs how can I kill multiple buffers without opening each individually
The command I was looking for M-x kill-matching-buffers
.
- Run M-x ibuffer (built-in command).
- On each line with a buffer you want to delete press 'd'.
- When finished press 'x' to commit changes.
C-x C-b
to list all buffers k
to mark buffers for kill (D appears next to buffer) x
to execute kill
A more interactive and versatile approach is with helm-buffers-list
:
- Type what you want to match.
- Select all matches with M-m (
helm-toggle-all-marks
). - Optionally, refine your selection with C-SPC (
helm-toggle-visible-marks
), using C-n/C-p to navigate. - Press TAB, select "kill buffers" from the available options. Other options are query-replace / occur / grep / revert, and a bunch of others.