nnn: A Blazing Fast Terminal File Browser For Pro Linux Users

Remember Googler, the command-line interface Google client and Buku, the command-line bookmark manager? We covered both of them last year. And now, I’m back with another command-line application, nnn from the same developer of Googler & Buku.

nnn

nnn is a file browser. It’s extremely lightweight and blazing-fast. The developer Arun Prakash forked it from another project called noice and made it a whole lot nicer with plenty of sugar on the top. In fact, the name nnn is intended to be a pun. We know that from the first line of its GitHub repository’s README file,

Noice is Not Noice, a noicer fork…

Jokes aside, the best part of nnn is its intuitive user experience. There is absolutely no learning curve. Just install it, do some little initial configurations and the rest of the path is smooth as silk.

unnamed-file-118-3941518
nnn Interface

It integrates nicely with any Desktop Environment. If you are a terminal fan, you might even consider ditching your GUI file browser after using nnn!

nnn Features

There are many features that nnn offers. Some of them were available on the original noice project and the rests are nnn toppings. You can find a complete list of features on its GitHub repository’s wiki. 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
unnamed-file-119-3787749
nnn Disk Analyzer Mode

Also, the developer has run some performance test and nnn has outperformed all of its alternatives. You can check the test results in its GitHub repository’s README file.

Suggested ReadMake Sudo Insult User For Each Incorrect Password Attempt

Installing nnn on Ubuntu

The developer of nnn maintains a PPA for Ubuntu. For installing nnn, just enter the commands below:

sudo add-apt-repository ppa:twodopeshaggy/jarun
sudo apt update
sudo apt install nnn

But, you might not get the latest version that way. So, you might want to consider installing it from the source. Enter the following commands in your terminal:

git clone --depth 1 https://github.com/jarun/nnn
cd nnn && make
sudo make install

And the installing is done.

Getting Started with nnn

Very minimal configuration is needed to get going.

By default, nnn uses the following applications for opening files:

  • vi as text editor
  • less as text viewer
  • mpv as media player
  • zathura as PDF viewer

You can change the first two by specifying EDITOR & PAGER bash variable. For doing that enter these lines in your ~/.bashrc file:

EDITOR=nano
PAGER=more

You can change the applications (nano and more is used here) as your wish. Now, to open a text file with editor highlight that file and press e, and for viewer press p.

If nnn can’t find any appropriate application for opening a file, it will need a fallback opener. We will use the default desktop opener for this purpose. Add this line in you ~/.bashrc file:

export NNN_FALLBACK_OPENER=xdg-open

Now you can open all types of files right from nnn. It can also open any directory with the GUI file manager. For enabling this add the following lines in your ~/.bashrc file:

export NNN_DE_FILE_MANAGER=caja

I’ve used caja, it’s the default file manager for Ubuntu MATE. You’ll have to use a file manager installed on your system, e.g.: nautilus for Ubuntu GNOME. For opening any directory with GUI file manager, highlight that directory and press o.

You can also copy the path of any file from nnn by pressing ctrl+k. For enabling this, enter the following commands:

sudo apt install xsel
mkdir -p $HOME/.config/nnn
printf '#!/bin/shnecho -n $1 | xsel --clipboard --input' > $HOME/.config/nnn/copier.sh
chmod +x $HOME/.config/nnn/copier.sh

And add the following line to your ~/.bashrc file:

export NNN_COPIER="$HOME/.config/nnn/copier.sh"

That’s all. Now you can start using nnn, by the following command:

nnn

For more detailed information, keyboard shortcuts and symbols used in nnn, visit the GitHub repository.

nnn GitHub Repo

What do you think about nnn? Are you going to stick with it? Any features you would like to see in nnn? You can share you opinion and suggestion in the comments section, the developer Arun Prakash will be seeing those. :)

Source