Emacs 26.1

First I create several buffers in shell mode.

enter image description here

Then I open ibuffer (C-x C-b) and mark all shell buffers manually by pressing D to delete them.

It works, but it's very slow. Is there a quicker method for deleting all buffers in shell mode?

  • 1
    A more general (but similar) question was asked here with a few answers.
    – jagrg
    Commented Sep 22, 2020 at 0:12

2 Answers 2


A slightly quicker way that still uses IBuffer, is (from IBuffer) to use % m shell to mark all of the buffers in shell mode, and then press D to delete then all in one go. Depending on what other modes you've got open you might get away with using "sh" instead of shell. I use variations on this quite a lot to kill the many Ag and Dired buffers that I seem to typically end up with.


You may want to look into the customizable var ibuffer-saved-filter-groups, to sort your buffers into groupings based on mode (or any other criteria). Then you can mark a group at once by marking its heading. Right now, they're all in one group [Default], but you could easily have [Shells], etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.