If you have used the Linux terminal for an extended period of time, you probably know some of the useful commands, like
cd to move into and out of folders, create new ones, and copy or move files. Still, you may prefer how desktop file managers are more user-friendly and quicker for some tasks. In that case, you’ll love nnn.
nnn is the equivalent of a desktop file manager for the terminal. Although not an ultra-complex solution like Midnight Commander, nnn is light on resources, fast, and allows you to navigate your file system without having to type commands.
nnn is available for multiple platforms, including Android, macOS, BSD, and Linux. Its installation depends on your platform of choice. nnn offers release packages for Arch Linux, CentOS, Debian, Fedora, and Ubuntu. For this tutorial, we’ll be using the latest version of Ubuntu, where you can easily install it with:
sudo apt install nnn
For more details and instructions on installing it on different distributions/OSes, take a look here.
After its installation completes, you can run nnn from your terminal with the command
nnn will list the files and folders of the current directory nnn is running on. The folders are listed at the top while the files are at the bottom.
To navigate around your file system, use the cursor keys. With the up and down keys, you move in that direction in its folders and files list. To enter a folder, press Enter or the right arrow key. To return one level up to the previous folder, use the left arrow key.
To open a file with the default application associated with its filetype, you can select the file, then hit Enter. In the screenshot below, we opened an image file with the default Image Viewer.
Similarly, if you pressed Enter on a txt file, it would open in Gedit or whatever text editor is the default in your distribution, etc.
Do note that in a server environment, you may not have any GUI applications installed to view the files you want.
Hide/Unhide and File Details
For security reasons, some files and folders are usually hidden from plain sight. To display them, press F5 to toggle their display.
To get more details about any file or folder, move the cursor over it and press Ctrl + F.
Select, Copy, Paste, and Delete
To select a file or folder:
1. Using the arrow keys, move over the desired file or folder and press Space on the keyboard. You’ll see a plus symbol to the left of the file or folder.
2. Repeat for any other file or folder you’d like to add to your selection. Note that your choices should be within the same folder.
3. To copy them to another folder, go to the folder you want to move the files to and press Ctrl + P. To move it instead of creating copies, use Ctrl + V.
To delete the selection, press Ctrl + X. nnn will ask you if you want to act on the current file or everything selected.
Working with Archives
To create a compressed archive of a collection of files and folders, select the files to be compressed and press z on the keyboard. Type a name for your archive and press Enter.
nnn can also work with existing archives. Press Enter on one of them, and nnn will ask you if you want to perform the default action (which will open the file in your default archive manager), extract its contents, etc.
Only the Beginning
nnn, as a file manager for the Terminal, can do more than what we have covered here. You can always use its help screen by pressing ? to find other ways to use it. Press Q afterward to return to its main interface. You can also extend nnn with plugins, though we haven’t covered it here.
If you are using the Linux terminal extensively, it is good to know how you can search the Web from the terminal.
Our latest tutorials delivered straight to your inbox