dired is Emacs built-in tool to work with directories and files. It
resembles the "commander" like tools which go beyond the command line,
but are not graphical in a modern sense. You will find that
To enter dired-mode do
C-x d directory <RET>
C-u C-SPCbrings the cursor back
Menu Regexp, Mark...allows to mark files by a regexp e.g.
\.vmc$selects all files with extension "vmc"
Menu Operate, Search Files...(dired-do-search) allows to search for content.
! find "redetho" *
When the files are all in the same directory or in not too many sub-directories:
\.ext$, which is a regexp to search for the file extension "ext"
Operate... > Query Replace in files
find-dired command lets you run arbitrary 'find' commands, then
displays the results in a dired buffer, including arbitrarily nested
E.g. to list all executable files containing the string "foo", case insensitively, rooted at /usr:
M-x find-dired <RET> //usr <RET> -iname "*foo*" -executable -type f
Move up one directory (this opens a new dired buffer):
Enter a directory without opening a new buffer (in contrast to
Move a file or a whole directory:
Use the up- or down-arrow in Emacs' mini-buffer to select a target path; paths in other Emacs windows will feature.
Do dired of the directory of the file you are currently editing:
Manually input a path (like CD xyz):
wcopies the name of the current file or the marked files to the "kill-ring" (clipboard)
C-0 wcopies the absolute path to the kill-ring
C-u wcopies the relative path to the kill-ring.
The last option deserves more explanation: there is the notion of
default-directory for each Emacs buffer. For a dired buffer, this
directory is normally the directory shown by dired. However, you can
M-x cd. Thus
C-u w will yield a
non-trivial relative path.
You can associate further file extensions with external commands, to open them from dired, e.g.
(add-to-list 'dired-guess-shell-alist-user '("\.mkv\'" "vlc"))
This complements what the variable
Toggling sorting between date and name:
To sort by size:
C-u s S
the big S is ls format option by size
Toggling detailed and terse view:
Get two "panes" (Emacs windows):
which is an alias of
Menu-bar -> File -> new-window-on-right
Or simply do
Switch between windows ("other" window):
To go back to one pane only:
Listing a directory via FTP:
:/directory/ part seems to be mandatory
To copy the dired path to the clipboard, move the cursor to top dired window line (i.e. the one with the path):
The path will end with a slash. Note: also under MS Windows this will yield forward slashes. However, the Windows tools accept paths with forward slashes too.
dired-listing-switches to "-Al")
-lalways has to be present.
To sort directories at the top and hide hidden files:
(setq dired-listing-switches "-lF --group-directories-first")
On Windows, dired is using a Lisp emulation of
ls. My preferences:
(quote ("%Y-%m-%d %H:%M:%S" "%Y-%m-%d %H:%M:%S")))
speedbar is Emacs built-in tool to explore directory trees, like you it in various graphical user interfaces. You start speedbar with
The speedbar is bound to the active frame and lives in its own frame.
speedbar can be used together with dired.
C-x d works in a
frame as well. It offers to
dired speedbar's "current" directory.
However, that directory is the one shown at the top of the speedbar
frame, not something in the tree that you might have opened below.
In other words: you need to go down to the wanted directory and use
RET to make it current. BTW:
U (shift-u) sets speedbar's current
directory "up" one level.