Emacs: File Manager, dired

By Xah Lee. Date: . Last updated: .

Emacs is a excellent tool for file management. For example, list files, copy/delete, rename, moving files, create/delete directory. Once you become familiar with it, you almost never go to shell or the OS desktop for these tasks.

emacs dired
M-x dired. emacs's feature for file management.

“dired” is short for Directory Edit. It is a old term for file management.

{Copy, Delete, Rename} File

To start viewing directory, called dired.

When in dired, most commands have a single letter key.

emacs dired menu 2015-10
emacs dired “Operate” menu

Here's the most useful commands:

Enter ↵dired-find-fileOpen the file or directory.
qquit-windowDone. Display last buffer. (call kill-buffer if you actually want to close it.)
Cdired-do-copyCopy file
Rdired-do-renameRename/move file
Ddired-do-deleteDelete file or directory
+dired-create-directorycreate new dir
Zdired-do-compresscompress/decompress the file by gzip

Mark/Unmark Multiple Files

Sometimes you want to copy or delete many files. You can mark the files, then apply a command on all marked files.

To mark a file, press m. Here's a list of basic marking commands:

basic dired marking commands
mdired-markmark a file
Udired-unmark-all-marksunmark all marked
% mdired-mark-files-regexpmark by pattern (regex)

For example, if you want to mark all HTML files, type 【% m】, then type \.html$.

Dired Navigation

Here are other common dired commands:

basic dired navigation commands
grevert-bufferrefresh dir listing
^dired-up-directorygo to parent dir
>dired-next-dirlineMove cursor to next subdirectory.
<dired-prev-dirlineMove cursor to previous subdirectory.

dired is often used together with shell-commandAlt+!】 or shell. 〔►see Emacs: Run Shell in Emacs

For complete list of dired commands, Alt+x describe-mode when in dired-mode.

(info "(emacs) Dired")

Dired topics

  1. Emacs: File Manager, dired
  2. Emacs: Dired Customization
  3. Emacs: Find Replace Text in Directory
  4. Emacs: Batch Rename Files
  5. Emacs: Sort File by Time, Size, in Dired
  6. Emacs: Open File in External App
  7. Emacs: Rename File from Space to Hyphen/Underscore
  8. Emacs: Convert Image Files in Dired

Open File topics

  1. Emacs: File Manager, dired
  2. Emacs: Bookmark Tutorial
  3. Emacs: Open Recently Opened File
  4. Emacs: Open File Fast
  5. Emacs: Open Last Closed File
  6. Emacs: Open File Path Under Cursor

Buffer topics

  1. Emacs: List Buffers
  2. Emacs: Switch Buffer
  3. Emacs: New Empty Buffer
  4. Emacs: Next/Previous User Buffer

Shell Topic

  1. Emacs: Run Shell in Emacs
  2. Why Run Shell in Emacs?
  3. Emacs: Difference between shell, term, eshell
  4. Emacs: M-x eshell
  5. Emacs: View Linux man Page
  6. Emacs: Interactive Abbrev
  7. Emacs: File Manager, dired
  8. Emacs: Batch Rename Files
  9. Linux: Basic Shell Commands
Like it? Buy Xah Emacs Tutorial. Thanks.