Emacs: List Buffers

By Xah Lee. Date: . Last updated: .

This page is a tutorial on managing buffers in emacs.

In emacs, every file is shown in a “buffer”. (You can think of “buffer” as opened file or tabbed window without the tab. It's called buffer because back in 1980s, emacs can only display parts of a file.)

Alt+x list-buffersCtrl+x Ctrl+b
List buffers.
Alt+x ibuffer
Improved version of list buffers. It colors the files by type.
Alt+x kill-bufferCtrl+x k
Close the current buffer.
emacs list-buffers 2021-07-20
emacs list-buffers 2021-07-20
emacs ibuffer 2021-07-20
emacs ibuffer 2021-07-20

Make ibuffer Default

To make ibuffer default, put the following in your init file:

(defalias 'list-buffers 'ibuffer) ; make ibuffer default

Batch Operation on Buffers

You can do operation in batch to the marked ones. Example:

Here's most useful ibuffer commands.

While in ibuffer, Alt+x describe-mode to see a full list of ibuffer commands.

Emacs, File and Buffer