Next: , Previous: Hiding Subdirectories, Up: Dired


38.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.

g
Update the entire contents of the Dired buffer (revert-buffer).
l
Update the specified files (dired-do-redisplay).
k
Delete the specified file lines—not the files, just the lines (dired-do-kill-lines).
s
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). Like the Dired file-operating commands, this command operates on the next n files (or previous −n files), or on the marked files if any, or on the current file. Updating the files means reading their current status, then updating their lines in the buffer to indicate that status.

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

To delete the specified file lines from the buffer—not delete the files—type k (dired-do-kill-lines). Like the file-operating commands, this command operates on the next n files, or on the marked files if any; but it does not operate on the current file as a last resort.

If you use k with a numeric prefix argument to kill the line for a file that is a directory, which you have inserted in the Dired buffer as a subdirectory, then this deletes that subdirectory from the buffer as well. 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 a 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.