Efficiently manage files with nnn
Tutorial – nnn
If you're a Linux lover, you'll know the command line is the slickest and most efficient way to interact with the system. Free yourself from point-and-click with the nnn command-line file manager.
Popular distros such as Ubuntu have given Linux to the masses with colorful icons and point-and-click interfaces. Still, experienced Linux users can save huge amounts of time and effort by staying within the command-line interface (CLI).
However, the Linux terminal itself doesn't make it easy to navigate quickly between files, plus you need to memorize a string of commands in order to rename, copy, and move files. This is where nnn comes in. If developer jarun's name sounds familiar, it's because he's also the author of ddgr – a CLI for the privacy-centric DuckDuckGo search engine, which we covered in issue 270 [1].
His utility nnn is inspired by an older minimalist file manager for the terminal, noice, from which it derives its rather recursive name (Nnn's Not Noice).
Like ddgr, nnn cuts out the GUI and allows you to perform operations efficiently. To get started, just fire up your regular terminal and run
sudo apt-get install nnn
for Debian-based Linux distros or
sudo dnf install nnn
for RHEL-based distros.
You can now fire up nnn by running nnn
from the command line (Figure 1).
![](/var/linux_magazin/storage/images/issues/2023/272/cli-file-manager/figure-1/823645-1-eng-US/Figure-1_large.png)
nnn Navigation
Once you fire up nnn, you can start navigating files and folders using the arrow keys. Press right to open a folder and left to return. Alternatively, you can use the same keys as for navigating Vim: H (left), L (right), K (up), and J (down).
When browsing files, simply hit enter in order to open a file within its default app. Out of the box, nnn only has limited support for opening files from within the terminal. You can, however, press e when a text file is highlighted to display contents. (Use :wq
when you're done.)
nnn Names
Once you're comfortable hopping from directory to directory, you may want to perform more advanced file operations.
Press ? to view a complete list of all available commands. (You can also type :wq
here to return to the main window.)
This list can seem overwhelming at first, so start simple. During testing, I downloaded a text file of Shakespeare's Romeo and Juliet, which Project Gutenberg has given the rather unhelpful filename rg1513.txt
.
In order to rename it, I simply navigated to the folder in question, highlighted it, and pressed Ctrl+R. A prompt appeared at the bottom of the window to enter a new filename (e.g., romeoandjuliet.txt)
.
An interesting quirk of nnn is that you can also copy files and folders to a new destination from here. Just press Ctrl+R as if you wanted to rename the file/folder and then press enter (Figure 2). The prompt will now allow you to enter the destination to which you want to copy the file.
![](/var/linux_magazin/storage/images/issues/2023/272/cli-file-manager/figure-2/823648-1-eng-US/Figure-2_large.png)
nnn Nominations
Although copying individual files can be useful, most often you'll need to move multiple files or even the contents of entire folders.
This is one area where using a file manager such as Nautilus can be much more convenient than entering multiple terminal commands to select individual files.
Luckily, nnn makes the selection process intuitive. In order to select a file or folder, just right-click on the file/folder or press the space bar (Figure 3). You can do this to multiple files within a folder or just press A to select them all. A + icon will appear next to selected files.
![](/var/linux_magazin/storage/images/issues/2023/272/cli-file-manager/figure-3/823651-1-eng-US/Figure-3_large.png)
If you can't find what you're looking for, use /
to open the prompt, which allows you to filter listings by keyword (Figure 4). You can also use D to toggle detailed file information such as creation date and size.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.