Emacs: File Manager, dired
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 Operating System file manager for these tasks.
“dired” is short for Directory Edit. It is a old term for file management.
To start viewing directory, Alt+x dired
.
When in dired, most commands have a single letter key.

Copy/Delete/Rename File
Here's the most useful commands:
dired-find-file
【Enter】- Open the file or directory.
quit-window
【q】- hide the dired buffer. (when you are done) Display last buffer.
dired-do-copy
【C】- Copy file
dired-do-rename
【R】- Rename/move file
dired-do-delete
【D】- Delete file or directory
dired-create-directory
【+】- Create new dir
dired-do-compress
【Z】- Compress/decompress the file by gzip
Tip: you can have copy command automatically select the target dir in a split pane.
Use
(setq dired-dwim-target t)
.
[see Emacs Init: Dired Config]
Mark Multiple Files for an Operation
Sometimes you want to copy or delete many files. You can mark the files, then apply a command on all marked files.

Here's basic marking commands:
dired-mark
【m】- Mark a file
dired-unmark
【u】- Unmark
dired-unmark-all-marks
【U】- Unmark all marked
dired-mark-files-regexp
【% m】-
Mark by regex. [see Emacs: Regular Expression]
For example, if you want to mark all HTML files, type % m, then typehtml$
.
- When there are marked files, dired command applies to the marked files.
- When no files are marked, dired command applies to the file under cursor.
Dired Navigation
Here are other common dired commands:
revert-buffer
【g】- 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.
Shell Command on File
dired-do-shell-command
【! 】- Prompt a shell command to run on the file the cursor is on.
Dired Help
When in dired, Alt+x describe-mode