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.
“dired” is short for Directory Edit. It is a old term for file management.
To start viewing directory, called
When in dired, most commands have a single letter key.
Here's the most useful commands:
|【Enter ↵】||Open the file or directory.|
|【q】||Done. Display last buffer. (call |
|【D】||Delete file or directory|
|【+】||create new dir|
|【Z】||compress/decompress the file by gzip|
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:
|【m】||mark a file|
|【U】||unmark all marked|
|【% m】||mark by pattern (regex)|
For example, if you want to mark all HTML files, type 【% m】, then type
Here are other common dired commands:
|【g】||refresh dir listing|
|【^】||go to parent dir|
|【>】||Move cursor to next subdirectory.|
|【<】||Move cursor to previous subdirectory.|
dired is often used together with
shell-command 【Alt+!】 or
shell. 〔➤see Emacs: Run Shell in Emacs〕
For complete list of dired commands, call
describe-mode when in dired-mode.
dired has many features and options.