Skip to content

Instantly share code, notes, and snippets.

@richsoni
Last active June 2, 2016 14:12
Show Gist options
  • Save richsoni/e541ecdbd2c01eddad50c26897f2ce4e to your computer and use it in GitHub Desktop.
Save richsoni/e541ecdbd2c01eddad50c26897f2ce4e to your computer and use it in GitHub Desktop.
dired

M-x dired

Updating

  • g Update the entire contents of the Dired buffer (revert-buffer).
  • l Update the specified files (dired-do-redisplay). You specify the files for l in the same way as for file operations.
  • s Toggle between alphabetical order and date/time order (dired-sort-toggle-or-edit).
  • C-u s Refresh the Dired buffer using switches as dired-listing-switches.

Deleting

  • d Flag this file for deletion.
  • u Remove deletion flag on this line.
  • x Delete the files that are flagged for deletion.

Viewing

  • f Visit the file described on the current line, like typing C-x C-f and supplying that file name (dired-find-file). See section Visiting Files.
  • o Like f, but uses another window to display the file's buffer (dired-find-file-other-window). The Dired buffer remains visible in the first window. This is like using C-x 4 C-f to visit the file. See section Multiple Windows.
  • C-o Visit the file described on the current line, and display the buffer in another window, but do not select that window (dired-display-file).
  • v View the file described on the current line, using M-x view-file (dired-view-file).

Marking

  • m mark
  • u unmark
  • C 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.
  • R Rename the specified files (dired-do-rename). The argument new is the directory to rename into, or (if renaming a single file) the new name.
  • S Make symbolic links to the specified files (dired-do-symlink). The argument new is the directory to make the links in, or (if making just one link) the name to give the link.
  • M Change the mode (also called "permission bits") of the specified files (dired-do-chmod). This uses the chmod program, so modespec can be any argument that chmod can handle.

Subdirs

  • i opens subdir
  • C-M-n Go to next subdirectory header line, regardless of level (dired-next-subdir).
  • C-M-p Go to previous subdirectory header line, regardless of level (dired-prev-subdir).
  • C-M-u Go up to the parent directory's header line (dired-tree-up).
  • C-M-d Go down in the directory tree, to the first subdirectory's header line (dired-tree-down).
  • $ Hide or reveal the subdirectory that point is in, and move point to the next subdirectory (dired-hide-subdir). A numeric argument serves as a repeat count.
  • M-$ Hide all subdirectories in this Dired buffer, leaving only their header lines (dired-hide-all). Or, if any subdirectory is currently hidden, make all subdirectories visible again. You can use this command to get an overview in very deep directory trees or to move quickly to subdirectories far away.

Finding

  • M-x find-name-dired
  • M-x find-grep-dired
  • M-x find-dired

enter

  • M-x wdired-...
  • C-C C-C save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment