Ranger

Overview

Ranger is a Vim-inspired, terminal-based file manager that is implemented in Python. But use of the Vim keybindings is not required, so it is useful even if you haven't internalized those keybindings.

See the Official User Guide for tips on efficient usage.

Installing

To install Ranger in macOS, install Homebrew and enter brew install ranger. To run it, enter ranger.

Help

For help, press the ? key. This displays a line at the bottom of the window that describes other keys that can be pressed for specific help.

KeyDescription
ccommands
kkey bindings
mman page
sview current settings

Configuration

Ranger user four configuration files, all found in the ~/.config/ranger directory.

Configuration FilePurpose
commands.pydefines Python functions that modify Ranger behavior
rc.confsets options and key bindings
rifle.confmaps file extensions to applications that should open them
scope.shshell script that generates file previews

For many users none of these files will need to be created or modified.

Functionality

Ranger displays three columns.

The left column shows the contents of the parent directory.

The middle column shows the contents of the current directory.

The right column shows the contents of the file selected in the middle column or a description of it.

Navigation always occurs in the middle column.

DirectionKeys
next item in current directoryj or down arrow
previous item in current directoryk or up arrow
into child directoryl or right arrow
edit file under cursorl or right arrow
into parent directoryh or left arrow

Text files are displayed in the right column. Non-text files are opened by their default application. For example, in macOS image files are opened in the Preview app.

Commands

Ranger commands can entered by pressing : which opens a line at the bottom for typing a command just like in Vim.

Commonly used commands are described in the table below.

CommandKey BindingDescription
cd dir-pathchanges current directory being displayed;
cannot use environment variables
copy [set|add|remove]yycopies cursor item or selected items;
argument defaults to set
cut [set|add|remove]ddcuts cursor item or selected items;
argument defaults to set
deletedDdeletes cursor item or selected items;
requests confirmation for non-empty directories or multiple files
editenteredits file under cursor using Vim
exitq or :qexits ranger
grep textsearches for text in selected files and directories
helpdisplays ranger help
linemode modeTODO: What are the supported modes?
mkdir dir-namecreates a directory
paste_extlike paste, but adds a unique suffix to name if it already exists
pastepppastes files or directories that were copied or cut
rename new-namecwrenames cursor item
touch file-namecreates a file
trashmoves cursor item to system trash
yank [name|dir|path]copies name, directory, or path of cursor item to clipboard
spacetoggles mark of cursor item
zh or deletetoggles display of hidden files

TODO: Which commands operate on marked files?

By default the copy, cut, and rename commands act on the file under the cursor. If multiple files have been selected, the copy and cut commands act on all of them.

To paste the file in a different directory, navigate to it and press pp.

After copying or cutting a file, its name is dimmed. To undo this, enter :copy remove or :cut remove.

To bookmark a directory, navigate to it and press m followed by the letter to assign. To navigate to a bookmark, press backtick and the letter.