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.

In ibuffer, the key sequence * u S D will save all unsaved files and close them. This is particularly useful after you've done a find replace on hundreds of files with dired-do-query-replace-regexp. [see Emacs: Find Replace Text in Directory]

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

Emacs Manage Buffers

Spent a few hours here?

Emacs Tutorial

Emacs Init

Emacs Keys

Elisp Basics

Elisp Examples

Elisp Advanced

Elisp Write Major Mode

Emacs Tutorial

Quick Start

Manage Windows



Find Replace




Rectangle Edit

Line Wrap


View Special File

Editing Brackets

Org Mode


Emacs Efficiency