Ranger is an incredibly handy terminal-based file navigator that's written in Python and is available for Linux and Mac.
Ranger allows you to navigate your filesystem using the arrow keys on your keyboard: Up/Down to select files in the current directory (middle pane), and Left/Right to hop back and forth through levels and into directories. When you're focused on a directory, it shows you the contents in the right-hand pane:
When you're focused on any kind of text file, it shows you a preview of the contents in the pane:
If you hit the Right arrow key, the file opens in your default editor (e.g., Nano or Vim), and quitting the editor brings you back to where you were. You can even use some Vim-like key commands to manage your files, like D to delete a file. I'm still learning all the handy tricks, but just being able to navigate the filesystem using arrow keys, easily see the contents of multiple directories, and update the view dynamically is really handy. The ability to quickly view or edit a file while you skim through some content is great, too.
I'd highly recommend Ranger to anyone who regularly uses the command line on a Raspberry Pi, Linux PC or server, or a Mac. Whether you're confined to SSH, prefer command-line access, or need to navigate around quicker than with the GUI, it's a great tool. No more cd, ls, cd, ls, cd .. tree, find, grep, etc.
Install Ranger
To install it on Debian/Ubuntu systems:
sudo apt install ranger
Or on Mac:
brew install ranger
Then type ranger to begin.
The version in the current Ubuntu LTS (18.04) and current stable Debian/Raspbian (Stretch) is unfortunately dependent on Python 2.7, but it's been upgraded to Python 3, and that version can be found in Ubuntu (since 19.04 (Disco)) and Debian Buster. It's also on PyPI, so you can pip install ranger-fm (not ranger!) to install it.
This was originally published on Ben Nuttall's Tooling blog and is reused with permission.
2 Comments