Emacs - Dired

Introduction

Aside from editing files, including local and remote ones, Emacs can also play the role of a file manager, i.e., manipulating directories and the files by its directory editor, dired.

Enter dired buffer

Dired can be entered in following ways:

  • Command: M-x dired
  • Key bindings

    • C-x d is equivalent to the command above.
    • C-x 4 d open a dired buffer in another window.

View and navigation

KeyDescription
(Toggle detail information (dired-hide-details-mode).
^Go up one directory (dired-up-directory).
n/C-nMove the point down an entry (dired-next-line).
p/C-pMove the point up an entry (dired-previous-line).
qQuit dired (quit-window).

Marking & unmarking

Marking and unmarking enable operations on multiple files or directories.

KeyDescription
mMark the active entry or the selected region (dired-mark).
uUnmark the active entry or the selected region (dired-unmark).
UUnmark everything (dired-unmark-all-marks).
dFlag for deletion (dired-flag-file-deletion).
~Mark backup files (dired-flag-backup-files).
* %Mark files and directories by regexp (dired-mark-files-regexp).
* cChange marks (dired-change-marks).
tToggle existing marking (dired-toggle-marks).

Operations

KeyDescription
f/RETVisit the file/directory (dired-find-file).
vView the file/directory in read-only mode (dired-view-file).
gRefresh dired buffer (revert-buffer).
+Create a directory (dired-create-directory).
CCopy marked files/directories (dired-do-copy).
RRename/move marked files/directories (dired-do-rename).
OPerform chown on marked files/directories (dired-do-chown).
GPerform chgrp on marked files/directories (dired-do-chgrp).
MPerform chmod on marked files/directories (dired-do-chmod).
DDelete marked files/directories (dired-do-delete).
xDelete flagged (marked by d) files/directories (dired-do-flagged-delete).

Working across directories

In dired buffer, typing i on a directory will insert it in the same dired buffer as a sub-directory.

By inserting multiple directories into a shared dired buffer, you can not only glance at multiple directories simultaneously but you can also work across them as if they were one large virtual directory.

Table of Contents