In emacs how can I kill multiple buffers without opening each individually

The command I was looking for M-x kill-matching-buffers.


  1. Run M-x ibuffer (built-in command).
  2. On each line with a buffer you want to delete press 'd'.
  3. 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:

  1. Type what you want to match.
  2. Select all matches with M-m (helm-toggle-all-marks).
  3. Optionally, refine your selection with C-SPC (helm-toggle-visible-marks), using C-n/C-p to navigate.
  4. Press TAB, select "kill buffers" from the available options. Other options are query-replace / occur / grep / revert, and a bunch of others.

Tags:

Emacs