Terminal GuideTerminal Guide
nnn icon

nnn

File Managers
macOSLinux
C

Ultra-lightweight and blazing fast file manager.

Official Website

Features

Ultra LightweightPlugin SystemBookmarksBatch Rename

Installation

Homebrew
brew install nnn
APT (Debian/Ubuntu)
apt install nnn
Pacman (Arch)
pacman -S nnn

Why use nnn?

Ultra Fast

One of the fastest file managers, written in C. Optimizes disk I/O and displays even 100,000+ file directories instantly.

Ultra Lightweight

Binary around 100KB, memory usage a few MB. Works on embedded systems and resource-constrained environments.

Plugin System

Extensible with many plugins. Add diverse features like fzf integration, preview, and archive operations.

4 Contexts

Four independent contexts (similar to tabs) allowing simultaneous operations on multiple directories.

Installation

Installation Commands
# Homebrew (macOS/Linux)
brew install nnn

# APT (Debian/Ubuntu)
sudo apt install nnn

# Pacman (Arch Linux)
sudo pacman -S nnn

# DNF (Fedora)
sudo dnf install nnn

# Build from source
git clone https://github.com/jarun/nnn.git
cd nnn
make
sudo make install

Nerd Font is required for icon display. With Homebrew, add the --with-nerdicons option.

Screen Layout

nnn uses a very simple single-pane layout. Preview can be added via plugins.

┌─ nnn v4.9 ────────────────────────────────────────────────────┐
│                                                               │
│  ~/.config                                                    │
│                                                               │
│    ..                                                        │
│    alacritty/                                                │
│    btop/                                                     │
│    fish/                                                     │
│    git/                                                      │
│    kitty/                                                    │
│  > nnn/                                                      │
│    nvim/                                                     │
│    ranger/                                                   │
│                                                               │
│                                                               │
├───────────────────────────────────────────────────────────────┤
│ 1/12 | ~/.config | 4.2M | 256 free                           │
└───────────────────────────────────────────────────────────────┘

[1-4] Context  [/] Search  [?] Help  [q] Quit

Basic Operations

KeyAction
j / k or ↑ / ↓Move up/down
h / ←Go to parent directory
l / → / EnterEnter directory / Open file
Home / gGo to start
End / GGo to end
/Search (real-time filter)
.Toggle hidden files
?Show help
qQuit

File Operations

KeyAction
SpaceSelect/deselect file
aSelect all
AInvert selection
pCopy
vMove
xDelete
Ctrl+RRename
nCreate new file/directory
rBulk rename

Contexts (Tabs)

nnn has four independent contexts. Each maintains its own directory history and selection state.

KeyAction
1-4Switch to context 1-4
TabMove to next context
`Move to previous context

Configuration & Customization

nnn is configured with environment variables. No config file, add to shell configuration.

~/.bashrc or ~/.zshrc
# ~/.bashrc or ~/.zshrc

# Configure nnn with environment variables
export NNN_PLUG='f:finder;o:fzopen;p:preview-tui;d:diffs;t:nmount;v:imgview'
export NNN_FIFO=/tmp/nnn.fifo
export NNN_COLORS='#0a1b2c3d'
export NNN_FCOLORS='c1e2272e006033f7c6d6abc4'
export NNN_TRASH=1
export NNN_ARCHIVE="\.(7z|bz2|gz|tar|tgz|zip|rar)$"

# For preview (with tmux/kitty etc.)
export NNN_PREVIEW=1

# Bookmarks
export NNN_BMS='d:~/Documents;D:~/Downloads;c:~/.config;g:~/github'

# For icon display (requires Nerd Font)
# brew install nnn --with-nerdicons

Plugins

Launch plugins with the ; key. Configure plugins with the NNN_PLUG environment variable.

Plugin Installation
# Install plugins
curl -Ls https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs | sh

# Plugins will be installed to ~/.config/nnn/plugins/

# Popular plugins
# preview-tui  - Terminal preview
# fzopen       - File selection with fzf
# finder       - Search plugin
# diffs        - Show differences
# imgview      - Image preview
# nmount       - Mount management
# dragdrop     - Drag & drop support

Popular Plugins

  • preview-tui - Preview with tmux/kitty
  • fzopen - File search with fzf
  • diffs - Show differences
  • imgview - Image preview

How to Use Plugins

Press ; then the configured key to launch. Example: ;p launches preview-tui

Shell Integration

To preserve the current directory when nnn exits, add this function:

~/.bashrc or ~/.zshrc
# ~/.bashrc or ~/.zshrc

# Preserve directory when nnn exits
n()
{
    # Prevent nested nnn
    [ "${NNNLVL:-0}" -eq 0 ] || {
        echo "nnn is already running"
        return
    }

    # Temporary file to get exit directory
    NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"

    # Launch nnn
    command nnn "$@"

    # Preserve directory
    [ ! -f "$NNN_TMPFILE" ] || {
        . "$NNN_TMPFILE"
        rm -f "$NNN_TMPFILE" > /dev/null
    }
}

# Alias settings
alias N='sudo -E nnn -dH'

Tips

Bookmarks

Press b to open bookmark menu. Configure bookmarks with NNN_BMS environment variable.

Disk Usage Analysis

Press d to show directory disk usage. Helpful for finding large files.

Change Sort Order

Press t to toggle sort order. Sort by name, size, modification time, etc.

Symbolic Links

Press P to create symbolic link. Creates link to selected file in current directory.

Written by Dai AokiPublished: 2026-01-20

Related Articles

Explore More