This section describes the basic Dired commands to operate on one file or several files. All of these commands are capital letters; all of them use the minibuffer, either to read an argument or to ask for confirmation, before they act. All of them let you specify the files to manipulate in these ways:
Certain other Dired commands, such as ! and the ‘%’ commands, use the same conventions to decide which files to work on.
In addition to Dired commands described here, you can also invoke Version Control (VC) commands on one or more files shown in a Dired buffer. See Version Control.
Commands which ask for a destination directory, such as those which copy and rename files or create links for them, try to guess the default target directory for the operation. Normally, they suggest the Dired buffer’s default directory, but if the option dired-dwim-target
is non-nil
, and if there is another Dired buffer displayed in some window, that other buffer’s directory is suggested instead. You can customize dired-dwim-target
to prefer either the next window with a Dired buffer, or the most recently used window with a Dired buffer, or to use any other function. When the value is a function, it will be called with no arguments and is expected to return a list of directories which will be used as defaults (i.e., default target and “future history”).
Here are the file-manipulating Dired commands that operate on files.
Copy the specified files (dired-do-copy
). The argument new is the directory to copy into, or (if copying a single file) the new name. This is like the shell command cp
.
The option dired-create-destination-dirs
controls whether Dired should create non-existent directories in the destination while copying/renaming files. The default value nil
means Dired never creates such missing directories; the value always
, means Dired automatically creates them; the value ask
means Dired asks you for confirmation before creating them.
If the option dired-create-destination-dirs-on-trailing-dirsep
is non-nil
in addition to dired-create-destination-dirs
, a trailing directory separator at the destination directory is treated specially. In that case, when copying to ‘test/’ and no directory ‘test’ exists already, it will be created and the specified source files or directories are copied into the newly created directory.
If dired-copy-preserve-time
is non-nil
, then copying with this command preserves the modification time of the old file in the copy, like ‘cp -p’.
The variable dired-recursive-copies
controls whether to copy directories recursively (like ‘cp -r’). The default is top
, which means to ask before recursively copying a directory.
The variable dired-copy-dereference
controls whether to copy symbolic links as links or after dereferencing (like ‘cp -L’). The default is nil
, which means that the symbolic links are copied by creating new ones.
The dired-keep-marker-copy
user option controls how this command handles file marking. The default is to mark all new copies of files with a ‘C’ mark.
Delete the specified files (dired-do-delete
). This is like the shell command rm
.
Like the other commands in this section, this command operates on the marked files, or the next n files. By contrast, x (dired-do-flagged-delete
) deletes all flagged files.
“Open” the specified files using an external program (dired-do-open
). The program is selected according to the system conventions, as determined by the variable shell-command-guess-open
.
Rename the specified files (dired-do-rename
). If you rename a single file, the argument new is the new name of the file. If you rename several files, the argument new is the directory into which to move the files (this is like the shell command mv
).
The option dired-create-destination-dirs
controls whether Dired should create non-existent directories in new.
The option dired-create-destination-dirs-on-trailing-dirsep
, when set in addition to dired-create-destination-dirs
, controls whether a trailing directory separator at the destination is treated specially. In that case, when renaming a directory ‘old’ to ‘new/’ and no directory ‘new’ exists already, it will be created and ‘old’ is moved into the newly created directory. Otherwise, ‘old’ is renamed to ‘new’.
Dired automatically changes the visited file name of buffers associated with renamed files so that they refer to the new names.
If the value of the variable dired-vc-rename-file
is non-nil
, files are renamed using the commands of the underlying VCS, via vc-rename-file
(see Deleting and Renaming Version-Controlled Files).
Make hard links to the specified files (dired-do-hardlink
). This is like the shell command ln
. The argument new is the directory to make the links in, or (if making just one link) the name to give the link.
Make symbolic links to the specified files (dired-do-symlink
). This is like ‘ln -s’. The argument new is the directory to make the links in, or (if making just one link) the name to give the link.
Make relative symbolic links to the specified files (dired-do-relsymlink
). The argument new is the directory to make the links in, or (if making just one link) the name to give the link. This is like dired-do-symlink
but creates relative symbolic links. For example:
It does not create absolute ones like:
foo -> /path/that/may/change/any/day/bar/foo
Change the mode (also called permission bits) of the specified files (dired-do-chmod
). modespec can be in octal or symbolic notation, like arguments handled by the chmod
program. This command does not follow symbolic links, so it reports an error if you try to change the mode of a symbolic link on a platform where such modes are immutable.
Change the group of the specified files to newgroup (dired-do-chgrp
).
Change the owner of the specified files to newowner (dired-do-chown
). (On most systems, only the superuser can do this.)
The variable dired-chown-program
specifies the name of the program to use to do the work. (This variable is necessary because different systems put chown
in different places).
Touch the specified files (dired-do-touch
). This means updating their modification times to timestamp, which defaults to the present time. This is like the shell command touch
.
Print the specified files (dired-do-print
). You must specify the command to print them with, but the minibuffer starts out with a suitable guess made using the variables lpr-command
and lpr-switches
(the same variables that lpr-buffer
uses; see Printing Hard Copies).
Compress the specified files (dired-do-compress
). If the file appears to be a compressed file already, uncompress it instead. Each marked file is compressed into its own archive; this uses the gzip
program if it is available, otherwise it uses compress
.
On a directory name, this command produces a compressed archive depending on the dired-compress-directory-default-suffix
user option. The default is a .tar.gz archive containing all of the directory’s files, by running the tar
command with output piped to gzip
. To allow decompression of compressed directories, typing Z on a .tar.gz or .tgz archive file unpacks all the files in the archive into a directory whose name is the archive name with the extension removed.
Compress the specified files (dired-do-compress-to
) into a single archive anywhere on the file system. The default archive is controlled by the dired-compress-directory-default-suffix
user option. Also see dired-compress-files-alist
.
Decrypt the specified files (epa-dired-do-decrypt
). See Dired integration in EasyPG Assistant User’s Manual.
Verify digital signatures on the specified files (epa-dired-do-verify
). See Dired integration in EasyPG Assistant User’s Manual.
Digitally sign the specified files (epa-dired-do-sign
). See Dired integration in EasyPG Assistant User’s Manual.
Encrypt the specified files (epa-dired-do-encrypt
). See Dired integration in EasyPG Assistant User’s Manual.
Load the specified Emacs Lisp files (dired-do-load
). See Libraries of Lisp Code for Emacs.
Byte compile the specified Emacs Lisp files (dired-do-byte-compile
). See Byte Compilation in The Emacs Lisp Reference Manual.
Run Info on this file (assumed to be a file in Info format).
Run man on this file (assumed to be a file in nroff
format).
Search all the specified files for the regular expression regexp (dired-do-find-regexp
).
This command is a variant of xref-find-references
(see Searching and Replacing with Identifiers), it displays the *xref* buffer, where you can navigate between matches and display them as needed using the commands described in Commands Available in the *xref* Buffer.
If any of the marked files are directories, then this command searches all of the files in those directories, and any of their subdirectories, recursively, except files whose names match grep-find-ignored-files
and subdirectories whose names match grep-find-ignored-directories
.
Perform query-replace-regexp
on each of the specified files, replacing matches for regexp with the string to (dired-do-find-regexp-and-replace
).
This command is a variant of xref-query-replace-in-results
. It presents an *xref* buffer that lists all the matches of regexp, and you can use the special commands in that buffer (see Commands Available in the *xref* Buffer). In particular, if you exit the query replace loop, you can use r in that buffer to replace more matches. See Searching and Replacing with Identifiers.
Like with dired-do-find-regexp
, if any of the marked files are directories, this command performs replacements in all of the files in those directories, and in any of their subdirectories, recursively, except for files whose names match grep-find-ignored-files
and subdirectories whose names match grep-find-ignored-directories
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4