20.2 Listing Existing Buffers

C-x C-b

List the existing buffers (list-buffers).

To display a list of existing buffers, type C-x C-b. This pops up a buffer menu in a buffer named *Buffer List*. Each line in the list shows one buffer’s name, size, major mode and visited file. The buffers are listed in the order that they were current; the buffers that were current most recently come first. This section describes how the list of buffers is displayed and how to interpret the various indications in the list; see Operating on Several Buffers, for description of the special mode in the *Buffer List* buffer and the commands available there.

.’ in the first field of a line indicates that the buffer is current. ‘%’ indicates a read-only buffer. ‘*’ indicates that the buffer is modified. If several buffers are modified, it may be time to save some with C-x s (see Commands for Saving Files). Here is an example of a buffer list:

CRM Buffer                Size  Mode              File
. * .emacs                3294  Emacs-Lisp        ~/.emacs
 %  *Help*                 101  Help
    search.c             86055  C                 ~/cvs/emacs/src/search.c
 %  src                  20959  Dired by name     ~/cvs/emacs/src/
  * *mail*                  42  Mail
 %  HELLO                 1607  Fundamental       ~/cvs/emacs/etc/HELLO
 %  NEWS                481184  Outline           ~/cvs/emacs/etc/NEWS
    *scratch*              191  Lisp Interaction
  * *Messages*            1554  Messages

The buffer *Help* was made by a help request (see Help); it is not visiting any file. The buffer src was made by Dired on the directory ~/cvs/emacs/src/. You can list only buffers that are visiting files by giving the command a prefix argument, as in C-u C-x C-b.

list-buffers omits buffers whose names begin with a space, unless they visit files: such buffers are used internally by Emacs.