Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Ranger File Manager Keyboard Shortcuts

· 6 min read · Home Tech

In this article
  1. Why Keyboard Shortcuts Matter in Ranger
  2. Basic Movement and Navigation
  3. Selecting and Acting on Files
  4. Viewing and Previewing Files
  5. Tabs, Bookmarks, and Filters
  6. Customizing Shortcuts
  7. Common Problems and Solutions
  8. Frequently Asked Questions

Ranger is a terminal-based file manager with a comprehensive set of keyboard shortcuts that let you navigate, select, and manipulate files without touching the mouse. The most essential shortcuts are h, j, k, l for movement, Space to select, yy to copy, dd to cut, and p to paste. This article covers the full default keybindings, how to customize them, and answers common questions about using Ranger efficiently.

Why Keyboard Shortcuts Matter in Ranger

Ranger is designed around the Vim philosophy: keep your hands on the keyboard and minimize keystrokes for common tasks. Unlike graphical file managers (like Nautilus or Finder), Ranger runs in a terminal and uses a three-column preview pane. The middle column shows the current directory, the right column previews the selected file, and the left column shows the parent directory. This layout, combined with modal keybindings, lets you move through directories and act on files with a few taps.

Because Ranger is keyboard-first, learning its shortcuts is not optional—it's the core of the experience. Once you internalize the basic movement keys, you can navigate your filesystem faster than with a mouse, especially when combined with filters and bookmarks.

Basic Movement and Navigation

Ranger uses Vim-style keys for movement. Here are the fundamental ones:

  • h – Go to parent directory (left column).
  • l – Enter the selected directory or open the file (right column).
  • j – Move down in the file list.
  • k – Move up in the file list.
  • gg – Jump to the first file.
  • G – Jump to the last file.
  • d – Go to the home directory (when pressed alone).
  • / – Search for files by name; type the query and press Enter.
  • n – Jump to the next match after a search.
  • N – Jump to the previous match.

You can also use arrow keys as alternatives, but the Vim-style keys are faster once you're used to them. To open a file, press l or Enter. To go back to the parent directory, press h or Backspace.

Selecting and Acting on Files

Ranger lets you select multiple files, copy/cut/paste them, and perform other file operations. Key shortcuts:

  • Space – Toggle selection of the current file (adds it to the selection set).
  • v – Invert selection (select all unselected, unselect all selected).
  • V – Enter visual mode; move with j/k to select a range.
  • yy – Copy (yank) the selected files.
  • dd – Cut (delete) the selected files (they are moved to the clipboard).
  • pp – Paste the copied/cut files into the current directory.
  • po – Paste and overwrite existing files.
  • pl – Paste as a symlink (creates a symbolic link).
  • dl – Delete the selected files permanently (no trash).
  • dD – Delete the selected files and move them to the trash (if supported by the system).
  • a – Rename the current file (opens a prompt).
  • cw – Rename the current file (same as a).
  • zh – Toggle hidden files (show/hide dotfiles).

Note that dd does not delete immediately; it cuts (like a “cut” operation). To actually delete, use dl or dD. This prevents accidental data loss.

Viewing and Previewing Files

Ranger's right column shows a preview of the selected file. For text files, it shows the content; for images, it may show a thumbnail (if you have the right tools installed). You can control the preview with these shortcuts:

  • i – Display the file in full screen (using the default pager).
  • s – Open the file with the default application (like double-clicking).
  • r – Open the file with a specific application (choose from a list).
  • z – Toggle the preview pane on/off.
  • Z – Toggle the preview pane to show only the file name.
  • ~ – Toggle the preview of hidden files (in the preview pane).

For text files, you can also scroll the preview with Ctrl-d (down) and Ctrl-u (up). If you have w3m or ueberzug installed, images can be previewed directly in the terminal.

Tabs, Bookmarks, and Filters

Ranger supports tabs and bookmarks to help you switch between directories quickly.

  • Tab – Switch to the next tab.
  • Shift+Tab – Switch to the previous tab.
  • Ctrl+n – Create a new tab.
  • Ctrl+w – Close the current tab.
  • Ctrl+r – Reload the current directory.
  • m – Add a bookmark for the current directory (then press a letter to assign it).
  • ‘ (single quote) – Jump to a bookmark (then press the letter).
  • f – Quickly filter files by typing a few characters (incremental search).
  • . – Toggle hidden files (same as zh).

Bookmarks are saved in the file ~/.config/ranger/bookmarks. Setting a bookmark for your frequent directories (like ~/Documents or /var/log) can save many keystrokes.

Customizing Shortcuts

Ranger's shortcuts are defined in the configuration file ~/.config/ranger/rc.conf. You can generate the default configuration with the command:

ranger --copy-config=rc

Then edit the file to change keybindings. For example, to make y copy instead of yy, you would add a line like:

map y copy

To add a new shortcut, use the map command. For instance, to bind Ctrl+s to sort by name:

map <Ctrl+s> sort name

You can also create command aliases. After editing, restart Ranger or reload the config with Ctrl+r.

Common Problems and Solutions

Many users run into a few common issues when using Ranger:

  • “dd” deletes my files! – No, dd cuts them. They are not deleted until you paste or use dl. If you accidentally cut a file, press p in the desired directory to paste it back.
  • Preview not working for images. – Ranger needs additional tools like w3m or ueberzug to display images. Install them via your package manager.
  • Can't exit Ranger. – Press q to quit. If that doesn't work, try ZQ (quit without saving).
  • Shortcuts don't work as expected. – Some shortcuts are context-sensitive. For example, d alone goes to home, but dd cuts. Make sure you're not in visual mode (V) or a search prompt.
  • How do I open a file with a specific program? – Press r to see a list of applications that can open the file type.

Frequently Asked Questions

How do I copy a file to another directory in Ranger?

Navigate to the file, press yy to copy it, then navigate to the destination directory and press pp to paste. The file is copied immediately.

Can I use Ranger with mouse support?

Yes, Ranger has mouse support enabled by default. You can click on files and directories to navigate, but the keyboard shortcuts are faster for most tasks.

How do I delete a file permanently?

Select the file and press dl. This deletes it without sending to trash. To send to trash, use dD (requires a trash utility like trash-cli).

What is the difference between yy and dd?

yy copies (yanks) the file, leaving the original intact. dd cuts (deletes) it from the current directory, but it's stored in the clipboard until you paste it elsewhere.

How do I jump to a specific directory quickly?

Use bookmarks: press m followed by a letter to bookmark the current directory, then press ‘ (single quote) followed by that letter to jump to it. You can also use cd command inside Ranger with :.

Does Ranger work on Windows?

Ranger is primarily for Unix-like systems (Linux, macOS, BSD). It can run on Windows via WSL (Windows Subsystem for Linux) or Cygwin, but it's not natively supported.