It is easier to navigate in Linux and look at its contents when you use the desktop Linux that has a file manager like Nautilus.
But when you are stuck to the terminal or you have to spend plenty of time there, browsing from one directory to another may become an annoying task. This is particularly painful if you are not too comfortable doing all the things in the terminal.
If you find that relatable, let me introduce you to a terminal-based file browser, nnn.
nnn: Terminal-based File Browser
nnn is a terminal-based file browser. With this, you can get some features of the GUI-based file managers in the terminal. It is somewhat better than relying on the cd command.
In fact, the name nnn is intended to be a pun. We know that from the first line of its GitHub repository’s old README file where it mentioned:
Noice is Not Noice, a noicer fork…
Jokes aside, the best part of nnn is its intuitive user experience. There is almost no learning curve. Just install it and start using. If you need some specific options, you need to do some minor configurations and the rest of the path is smooth as silk.
If you are a terminal fan, you might even feel like ditching your GUI file browser after using nnn!
nnn: Feature Overview
There are many features that nnn offers. You can find a complete list of features on it GitHub page. However, the main features include:
- Intuitive navigation through the file-system
- Useful nifty shortcuts and key-bindings
- Disk usage analyzer mode
- Basic and Detailed mode
- Multiple sorting preferences
- Desktop opener integration to handle different types of files
- Disk-IO sensitive
- Light on system resources
- Language-agnostic plugins
- Easy to compile because of minimum dependencies
- Unicode support
- Respects privacy of users
- Neo Vim plugin available
- Ability to view files as you navigate (configuration needed)
- Basic support for screen readers and braille displays
- 1-column mode for smaller terminals and form factors
Also, the developer has run some performance tests and nnn has outperformed all of its alternatives. You can check the test results in its GitHub’s wiki page.
Installing nnn on Linux
You can find nnn available through various package managers. On Ubuntu or any Debian-based distro, you can simply type in:
sudo apt install nnn
Unfortunately, if you need it to look fancy with some icons as well (as shown in a screenshot above), you will need to compile it and set it up. You can type in the commands below to compile it and get started.
git clone --depth 1 https://github.com/jarun/nnn cd nnn sudo make O_NERD=1 sudo cp nnn /usr/bin
And, then you can launch nnn by simply typing:
It is important to note that after compiling I copied the nnn directory to the usr/bin where executable binaries/commands reside. You can choose to have it on any other directory and manually run it using the command:
In case you run into issues when trying to compile for the first time, you might want to run this:
sudo apt install build-essential cmake libboost-all-dev
In this case, I have utilized Pop OS 20.04. The steps might differ depending on your distribution. So, make sure to check the documentation/wiki on their GitHub page as well.
Getting Started with nnn
If you just want to browser and navigate through the terminal and prefer to open the files/documents through their respective default applications, you do not need to configure anything.
You navigate to the file and hit ENTER to see the file being accessed by the respective desktop application.
For basic navigation and details, you would need to utilize a few keyboard shortcuts.
You may want to use the D key — to expand file details to show file size, date/time modified, and permission for the file.
If you hit
e, it will launch the editor navigation mode. And, you can simply use the arrow buttons to navigate back and forth.
By default, it is a simple and efficient terminal-based file manager. But, there’s a lot of things that you can configure and setup, which will differ depending on the distribution you’re using.
So, if you are interested to customize it and make use of all the plugins, you may want to refer this video by Dave Snider:
What do you think about nnn? Isn’t this a super cool open-source file manager for the terminal?
Let me know your thoughts in the comments down below.