30.14. Updating the Dired Buffer

This section describes commands to update the Dired buffer to reflect outside (non-Dired) changes in the directories and files, and to delete part of the Dired buffer.


Update the entire contents of the Dired buffer (revert-buffer).


Update the specified files (dired-do-redisplay).


Delete the specified file lines--not the files, just the lines (dired-do-kill-lines).


Toggle between alphabetical order and date/time order (dired-sort-toggle-or-edit).

C-u s switches RET

Refresh the Dired buffer using switches as dired-listing-switches.

Type g (revert-buffer) to update the contents of the Dired buffer, based on changes in the files and directories listed. This preserves all marks except for those on files that have vanished. Hidden subdirectories are updated but remain hidden.

To update only some of the files, type l (dired-do-redisplay). This command applies to the next n files, or to the marked files if any, or to the current file. Updating them means reading their current status from the file system and changing the buffer to reflect it properly.

If you use l on a subdirectory header line, it updates the contents of the corresponding subdirectory.

To delete the specified file lines--not the files, just the lines--type k (dired-do-kill-lines). With a numeric argument n, this command applies to the next n files; otherwise, it applies to the marked files.

If you kill the line for a file that is a directory, the directory's contents are also deleted from the buffer. Typing C-u k on the header line for a subdirectory is another way to delete a subdirectory from the Dired buffer.

The g command brings back any individual lines that you have killed in this way, but not subdirectories--you must use i to reinsert each subdirectory.

The files in a Dired buffers are normally listed in alphabetical order by file names. Alternatively Dired can sort them by date/time. The Dired command s (dired-sort-toggle-or-edit) switches between these two sorting modes. The mode line in a Dired buffer indicates which way it is currently sorted--by name, or by date.

C-u s switches RET lets you specify a new value for dired-listing-switches.