Post

28 Dired commands

KeystrokesCommand nameAction
C-x d File Open DirectorydiredStart Dired.
A Operate Search Filesdired-do-searchDo a regular expression search on marked files; stops at first match;M-, finds next match.
B Operate Byte-compiledired-do-byte-compileByte-compile file.
C Operate Copy todired-do-copyCopy file.
d Mark Flagdired-flag-file-deletionFlag for deletion.
D Operate Deletedired-do-deleteQuery for immediate deletion.
e Immediate Find This Filedired-find-fileEdit file.
fdired-advertised-find-fileFind (so you can edit).
g Immediate Refreshrevert-bufferReread the directory from disk.
G Operate Change Groupdired-do-chgrpChange group permissions.
hdescribe-modeDisplay descriptive help text for Dired.
H Operate Hardlink to ...dired-do-hardlinkCreate a hard link to this file; Emacs asks you to name the hard link (not all OSes support hard links).
i Subdir Insert This Subdir ...dired-maybe-insert-subdirAdd a listing of this subdirectory to the current dired buffer; if it’s already there, just move to it.
kdired-do-kill-linesRemove line from display (don’t delete file).
L Operate Loaddired-do-loadLoad file.
m or * m Mark Markdired-markMark with*.
M Operate Change Modedired-do-chmodUsechmod command on this file.
ndired-next-lineMove to next line.
o Immediate Find in Other Windowdired-find-file-other-windowFind file in another window; move there.
C-o Immediate Display in Other Windowdired-display-fileFind file in another window; don’t move there.
O Operate Change Ownerdired-do-chownChange ownership of file.
pdired-previous-lineMove up a line.
P Operate Printdired-do-printPrint file.
qquit-windowQuit Dired.
Q Operate Query Replace in Filesdired-do-query-replaceQuery replace string in marked files.
R Operate Rename todired-do-renameRename file.
S Operate Symlink todired-do-symlinkCreate a symbolic link to this file; Emacs asks you to name the symbolic link.
sdired-sort-toggle-or-editSort the Dired display by date or by filename (toggles between these).
t Mark Toggle Marksdired-toggle-marksToggle marks on files and directories; pressingt once marks all unmarked files and directories; pressing t again restores original marks.
u Mark Unmarkdired-unmarkRemove mark.
v Immediate View This Filedired-view-fileView file (read-only).
wdired-copy-filename-as-killCopy filename into the kill ring; if multiple files are marked, copy names of all marked files to kill ring.
xdired-do-flagged-deleteDelete files flagged withD.
ydired-show-file-typeDisplay information on the type of the file using thefile command.
Z Operate Compressdired-do-compressCompress or uncompress file.
~ Mark Flag Backup Filesdired-flag-backup-filesFlag backup files for deletion;C-u ~ removes flags.
# Mark Flag Auto-save Filesdired-flag-auto-save-filesFlag auto-save files for deletion;C-u # removes flags.
& Mark Flag Garbage Filesdired-flag-garbage-filesFlag “garbage” files for deletion.
.Mark Mark Old Backupsdired-clean-directoryFlag numbered backups for deletion (if any).
= Immediate Diffdired-diffCompare this file to another file (the one at the mark).
M-= Immediate Compare With Backupdired-backup-diffCompare this file with its backup file.
! or X Operate Shell Commanddired-do-shell-commandAsk for shell command to execute on the current file or marked files.
+ Immediate Create Directorydired-create-directoryCreate a directory.
> Subdir Next Dirlinedired-next-dirlineMove to next directory.
< Subdir Prev Dirlinedired-prev-dirlineMove to previous directory.
^dired-up-directoryFind the parent directory in a new Dired buffer.
$ Subdir Hide/Unhide Subdirdired-hide-subdirHide or show the current directory or subdirectory.
M-$ Subdir Hide Alldired-hide-allHide all subdirectories, leaving only their names; repeat command to show.
C-M-n Subdir Next Subdirdired-next-subdirMove to next subdirectory (if you’ve inserted subdirectories usingi).
C-M-p Subdir Prev Subdirdired-prev-subdirMove to previous subdirectory (if you’ve inserted subdirectories usingi).
C-M-u Subdir Tree Updired-tree-upIf you’ve inserted subdirectories usingi, move to the parent directory in this buffer.
C-M-d Subdir Tree Downdired-tree-downIf you’ve inserted subdirectories usingi, move to the first subdirectory for this directory in this buffer.
* c Mark Change Marksdired-change-marksChange marks on specified files, for example, from* (generic mark) to D (flagged for deletion).
* ! or M-Del Mark Unmark Alldired-unmark-all-filesRemove all marks from all files.
* * Mark Mark Executablesdired-mark-executablesMark executables;C-u * unmarks.
* / Mark Mark Directoriesdired-mark-directoriesMark directories;C-u / unmarks.
* @ Mark Mark Symlinksdired-mark-symlinksMark symlinks;C-u * @ unmarks.
M-} Mark Next Markeddired-next-marked-fileMove to the next file marked with* or D.
M-{ Mark Previous Markeddired-prev-marked-fileMove to previous file marked with* or D.
% d Regexp Flagdired-flag-files-regexpFlag for deletion files that match regular expression.
% g Regexp Mark Containingdired-mark-files-containing-regexpMark files whose contents match regular expression.
% l Regexp Downcasedired-downcaseLowercase marked files.
% R Regexp Markdired-do-rename-regexpRename files with filenames that match regular expression.
% u Regexp Upcasedired-upcaseUppercase marked files.
This post is licensed under CC BY 4.0 by the author.