Code Yarns ‍👨‍💻
Tech BlogPersonal Blog


How to install and use Ranger

📅 2013-Aug-26 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ preview, ranger, ubuntu ⬩ 📚 Archive

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 a user of vim.

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!

https://www.youtube.com/watch?v=E9LCsGWYuiE

Install

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:

$ git clone https://github.com/hut/ranger.git
$ cd ranger
$ sudo make install

Usage

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

When you are operating on files:

Tried with: Ranger 1.5.2 and Ubuntu 12.04


© 2026 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 Mastodon🦋 Bluesky📧 Email