How to install and use Ranger

Image preview in Ranger
Image preview in Ranger

Ranger is a file manager for the shell with vi keybindings. Its interface is similar to the Finder in Mac OS X. You can move up and down files or directories in the current path by pressing j and k. To move to parent directory use h and to open the directory or file currently highlighted press l. These navigation keys should be very intuitive for the vim user.

Ranger can also utilize many other tools to show previews of many types of files. This is really useful because you can see previews of source code, contents of zip files, text inside PDF files and even ASCII rendering of image files (JPG/PNG) all from inside ranger in color!


If you like the previews, first install those relevant tools, followed by ranger from the Ubuntu repositories:

$ sudo apt install highlight atool w3m poppler-utils caca-utils
$ sudo apt install ranger

The version of Ranger in Ubuntu can be pretty old. To install the latest Ranger from source:

  • Download the latest Ranger source code from Github here:
$ git clone
  • Build and install:
$ cd ranger
$ sudo make install


Run ranger once so that it creates its default configuration directory in ~/.config/ranger. After that run ranger so that it copies over its configuration files to this location. This is necessary to configure ranger or for it to enable previews.

$ ranger
$ ranger --copy-config=all

After this you are good to go: enjoy navigating around your directory and seeing colorful previews of all your files, right in your shell! 🙂

Keyboard shortcuts

Space: Select current file or directory
Del: Delete selected files and directories

S: Open shell in current directory
Ctrl+n: Open new tab
Tab: Switch to next tab
Ctrl+w: Close tab

gh: Go to home directory
gr: Go to root directory
gm: Go to media directory

cw: Rename current file or directory
zh: Show hidden files and directories
dc: Compute size of directory under cursor. Size is displayed in status line at bottom.

On files:
Enter: Open in default program.
i: Open in pager.
r: Open with
o: Change sort order
Space: Select/unselect current file

Tried with: Ranger 1.5.2 and Ubuntu 12.04

3 thoughts on “How to install and use Ranger

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.