Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Next: , Previous: Dired Visiting, Up: Dired


38.6 Dired Marks vs. Flags

Instead of flagging a file with ‘D’, you can mark the file with some other character (usually ‘*’). Most Dired commands to operate on files use the files marked with ‘*’, the exception being x which deletes the flagged files.

Here are some commands for marking with ‘*’, or for unmarking or operating on marks. (See Dired Deletion, for commands to flag and unflag files.)

m
* m
Mark the current file with ‘*’ (dired-mark). With a numeric argument n, mark the next n files starting with the current file. (If n is negative, mark the previous −n files.)
* *
Mark all executable files with ‘*’ (dired-mark-executables). With a numeric argument, unmark all those files.
* @
Mark all symbolic links with ‘*’ (dired-mark-symlinks). With a numeric argument, unmark all those files.
* /
Mark with ‘*’ all files which are actually directories, except for . and .. (dired-mark-directories). With a numeric argument, unmark all those files.
* s
Mark all the files in the current subdirectory, aside from . and .. (dired-mark-subdir-files).
u
* u
Remove any mark on this line (dired-unmark).
<DEL>
* <DEL>
Move point to previous line and remove any mark on that line (dired-unmark-backward).
* !
U
Remove all marks from all the files in this Dired buffer (dired-unmark-all-marks).
* ? markchar
M-<DEL>
Remove all marks that use the character markchar (dired-unmark-all-files). The argument is a single character—do not use <RET> to terminate it. See the description of the * c command below, which lets you replace one mark character with another.

With a numeric argument, this command queries about each marked file, asking whether to remove its mark. You can answer y meaning yes, n meaning no, or ! to remove the marks from the remaining files without asking about them.

* C-n
M-}
Move down to the next marked file (dired-next-marked-file) A file is “marked” if it has any kind of mark.
* C-p
M-{
Move up to the previous marked file (dired-prev-marked-file)
t
* t
Toggle all marks (dired-toggle-marks): files marked with ‘*’ become unmarked, and unmarked files are marked with ‘*’. Files marked in any other way are not affected.
* c old-markchar new-markchar
Replace all marks that use the character old-markchar with marks that use the character new-markchar (dired-change-marks). This command is the primary way to create or use marks other than ‘*’ or ‘D’. The arguments are single characters—do not use <RET> to terminate them.

You can use almost any character as a mark character by means of this command, to distinguish various classes of files. If old-markchar is a space (‘ ’), then the command operates on all unmarked files; if new-markchar is a space, then the command unmarks the files it acts on.

To illustrate the power of this command, here is how to put ‘D’ flags on all the files that have no marks, while unflagging all those that already have ‘D’ flags:

          * c D t  * c SPC D  * c t SPC
     

This assumes that no files were already marked with ‘t’.

% m regexp <RET>
* % regexp <RET>
Mark (with ‘*’) all files whose names match the regular expression regexp (dired-mark-files-regexp). This command is like % d, except that it marks files with ‘*’ instead of flagging with ‘D’. See Flagging Many Files.

Only the non-directory part of the file name is used in matching. Use ‘^’ and ‘$’ to anchor matches. Exclude subdirectories by hiding them (see Hiding Subdirectories).

% g regexp <RET>
Mark (with ‘*’) all files whose contents contain a match for the regular expression regexp (dired-mark-files-containing-regexp). This command is like % m, except that it searches the file contents instead of the file name.
C-_
Undo changes in the Dired buffer, such as adding or removing marks (dired-undo). This command does not revert the actual file operations, nor recover lost files! It just undoes changes in the buffer itself. For example, if used after renaming one or more files, dired-undo restores the original names, which will get the Dired buffer out of sync with the actual contents of the directory.

 
 
  Published under the terms of the GNU General Public License Design by Interspire