nnn is an excellent command line based file manager for Linux, macOS and BSDs
The program nnn is one of the lightest file managers available for Linux, macOS, BSDs. It is not your traditional file browser though as it lacks a graphical user interface.
Tip: if you are looking for a traditional file manager instead, check out File Commander.
To install it, download one of the pre-compiled binaries from the releases page. Since it is a command line interface app, fire up a terminal and type nnn to launch it. There you go, a file manager inside the terminal. I came across it in a YouTube video by Luke Smith and was intrigued by it.
Use the up and down arrow keys to navigate up or down in the file and folder structure, and left and right arrow keys go back or forward. The Enter-key opens a folder or file, and you can use Page Up or Down to scroll up and down a directory. Use the Q key to quit the app or exit certain views.
Note: Hit the ? key to view a cheat-sheet of all the keyboard shortcuts. Use the H key when in the help menu to view an explanation of the shortcuts.
Speaking of which there are many keyboard shortcuts which use the Shift and Control key for combos. For e.g. you can use Shift + P to copy files, Ctrl + O to open with (and enter the name of the file handler program). The numbers that you see at the top can be activated by holding down the Shift-key and pressing the corresponding number on the keyboard. These work like tabs in other programs so that you may have different views open.
Want to select a single file? Highlight it and hit the space key. Once selected, you may perform actions on the selection such as using F2 to rename the file.Â Control is used for range selection (that's the same as multi selection which you would do with Shift).
Once you're in a folder, you can access the files in it by selecting them. Since nnn lacks a previewer, it will open the files in their default handler app. But the one exception to this is text documents which it can open directly. You can edit text files by hitting e, or view them by using p.
Search for folders instantly
nnn has an as-you-type search which can be toggled with the / key. It supports regex and substring formats; the functionality provides advanced search functionality but advanced queries require that users know how to use regular expressions and the options provided by the file manager.
Did you know nnn can be used as a file archiver? It can open, extract and create archives. Use F to create an archive, and Ctrl + F to extract one. T opens the archive and Shift + F lists the contents of the archive.
nnn supports plugins which greatly increase its functionality (play music, upload to imgur, view PDF, etc). You can install plugins with the command:
curl -Ls https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs | sh
To access plugins use Shift + R, which displays a list of available plugins. Execute the plugin with the enter key. For e.g. if you wanted to calculate the checksum value of a file, you should select the file. Then use Shift + R, highlight the checksum plugin and enter.
I haven't scratched nnn's surface. You can do a lot more with the program, but this should hopefully get you started with the basics.
This article was partially based on the official nnn Wiki. I simplified it a bit.
The file manager nnn is an advanced tool that may appeal to users who use Terminal regularly the most. Its advanced capabilities may make it interesting to advanced users who need to locate specific files and folders quickly, or run actions on those. The available plugins extend the functionality of the program significantly.
Now You: What is your favorite file manager on *nix systems?
My favorite file manager is Midnight Commander. But i’ll try nnn.
I replaced mc with nnn since it added the support for SSHFS. While mc is an excellent file manager, it’s predominantly menu-driven with confirmation boxes popping up every now and then. nnn on the other hand, is shortcut driven with a clean/minimal interface. It has all the features I used in mc and even some more like disk usage, image/video previews. Speaking of previews, the plugin framework is a BIG plus – you can add any functionality very easily.
I’m still waiting for XTree for Linux.
I haven’t, but it looks like it might do the job.
Very nice! I fired up a copy of bash in WSL and ran nnn on my Windows folders. Works perfectly.
You know, Ashwin and Martin, you’re putting so many new goodies out there that I just HAVE to try – I’m losing hours of productivity every week. :-)
There’s also fff (https://github.com/dylanaraps/fff) written in pure bash.
If I want to settle for a script, I would pick the more featured ranger. Also, the bash dependency is enforced on a zsh user like me.
The ultimate command line file manager for linux is ranger.
It even uses vi key style commands.
fff (https://github.com/dylanaraps/fff), nnn and lf (https://github.com/gokcehan/lf) also have vi style commands, and nnn and lf should be more performant given they are written in C and GO. I mostly just use fff as I mostly use for navigation in terminal (configured to switch to the current directory upon exit of fff).
This is my new favourite!
Tons of features and incredible speed. Thanks for the article!
Another filemanager for the unix console is dired inside emacs.
A great post! Thanks for the article!