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, Alt+x 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:

dired-find-fileEnter
Open the file or directory.
quit-windowq
Done. Display last buffer. (call kill-buffer if you actually want to close it.)
dired-do-copyC
Copy file
dired-do-renameR
Rename/move file
dired-do-deleteD
Delete file or directory
dired-create-directory+
Create new dir
dired-do-compressZ
Compress/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.

dired mark menu
dired mark menu

Here's basic marking commands:

dired-markm
Mark a file
dired-unmarku
Unmark
dired-unmark-all-marksU
Unmark all marked
dired-mark-files-regexp% m
Mark 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:

revert-bufferg
Refresh dir listing
dired-up-directory^
Go to parent dir
dired-next-dirline>
Move cursor to next subdirectory.
dired-prev-dirline<
Move 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 Customization

Emacs: Dired Customization

If you have a question, put $5 at patreon and message me on xah discord.
Or support me by Buy Xah Emacs Tutorial

Emacs Tutorial

Emacs Init

Emacs Keys

ELisp

ELisp Examples

ELisp Write Major Mode


Emacs Tutorial

Quick Start

Manage Windows

File

Buffer

Find Replace

Copy/Paste

Unicode

Whitespace

Rectangle Edit

Line Wrap

Shell

View Doc

Working with Brackets

Power Editing

Org Mode

HTML

Emacs Efficiency

Misc