File management

Table of Contents


  • Browsing through a long list of files in the directory (not too different from ls -lah).
  • For directories that contain many files (n > ??), ido-mode will not function.
  • dired-mode useful for deleteing/renaming files and applying shell-commands to them (e.g., open or gnome-open, wc -l).
  • Dired mode functions also useful for writing Emacs Lisp shell scripts.


task keybinding function
update dir listing g (revert-buffer)
toggle sorting by date s (dired-sort-toggle-or-edit)
mark a file m (dired-mark)
unmark file u (dired-unmark)
unmark all U (dired-unmark-all-marks)
mark by regex %m (dired-mark)
create dir + (dired-create-directory)
rename file R (dired-do-rename)
copy file C (dired-copy-file)
delete file D (dired-do-delete)
compress/decompress file Z (dired-do-compress)
shell-command (e.g., open) ! (dired-do-shell-command)
shell-command asynchronous & (dired-do-async-shell-command)
chmod M (dired-do-chmod)
chown O (dired-do-chown)
create symbolic link S (dired-do-symlink)
view file or directory a (dired-find-alternate-file)
view enclosing directory ^ (diredp-up-directory)

Can use m to mark file(s), then apply R, C, D, etc.

To use (dired-find-alternate-file), (put 'dired-find-alternate-file 'disabled nil) must be set. Already configured in aprl-config.

See also:

For colored formatting I use dired+ [./].


The find-lisp library contains a few OS-agnostic 'nix-like find operations. The most useful interactive function is M-x find-lisp-find-dired, which accepts arguemnts of DIR and REGEXP.

Two additional interactive functions from this library are find-lisp-find-dired-subdirectories (list all subdirectories of argument DIR) and find-lisp-find-dired-filters (set default REGEXP to be used by find-lisp-find-dired-internal, which is not interactive). I have never used the latter function.

recursive grep

Use M-x rgrep for most tasks.

For finer control, access grep, egrep, and grep-find functions with the M-x prefix. The advantage of grep-find in particular, over the find -exec grep called through the terminal, is the value-added proposition of syntax highlighting and interaction (click on the entry to go to that location in the file, which is opened in a buffer) offered by Emacs.

Emacs pages: main aprl-config

Generated by Org-mode 9.2 with Emacs 26