Overview
nnn (n-cubed) is a full-featured, blazing fast terminal file manager written in C with an extremely small footprint. It uses less than 3.5MB of resident memory and starts up instantly. nnn provides a clean, keyboard-driven interface for file navigation, search, bulk operations, and integrates with the system clipboard, desktop opener, and a rich plugin ecosystem.
nnn supports sessions, bookmarks, contexts (virtual workspaces), disk usage analysis, batch renaming, and extensive type-based file filtering. It follows the Unix philosophy, delegating operations to external tools when appropriate, and can be extended with shell-based plugins for everything from file preview to cloud sync.
Installation
# macOS
brew install nnn
# Ubuntu/Debian
sudo apt install nnn
# Arch Linux
sudo pacman -S nnn
# Fedora
sudo dnf install nnn
# FreeBSD
pkg install nnn
# From source
git clone https://github.com/jarun/nnn.git
cd nnn && make O_NERD=1
sudo make install
# Verify
nnn -V
Core Navigation
| Key | Action |
|---|
h or Left | Parent directory |
l or Right or Enter | Open file/enter directory |
j or Down | Next entry |
k or Up | Previous entry |
Home or g | First entry |
End or G | Last entry |
~ | Go to home directory |
- | Go to last visited directory |
@ | Go to start directory |
. | Toggle hidden files |
q | Quit |
Q | Quit and cd to current dir |
File Operations
| Key | Action |
|---|
Space | Select/deselect entry |
a | Select all |
A | Invert selection |
p | Copy selected to current dir |
v | Move selected to current dir |
x | Delete selected |
X | Delete current entry |
e | Edit file in $EDITOR |
n | Create new file/directory |
r | Rename entry |
Ctrl+R | Rename using $EDITOR |
y | Copy file path(s) |
Y | Copy entry name |
d | Toggle detail mode |
D | Show disk usage |
Contexts (Virtual Workspaces)
| Key | Action |
|---|
1-4 | Switch to context 1-4 |
Tab | Next context |
Shift+Tab | Previous context |
# nnn supports 4 contexts (like virtual desktops)
# Each context remembers its own directory and selections
# Switch with keys 1-4
Search and Filter
| Key | Action |
|---|
/ | Filter entries (as you type) |
Escape | Clear filter |
Ctrl+L | Open filter (and close on match) |
# Type / then start typing to filter
# Fuzzy matching by default
# Regex supported
Sorting
| Key | Action |
|---|
t | Toggle sort order |
Ctrl+T | Toggle sort by time |
s | Toggle sort by size |
S | Toggle sort by extension |
v | Toggle sort by version |
Bookmarks
# Set up bookmarks via environment variable
export NNN_BMS='h:~/;d:~/Documents;p:~/Projects;D:~/Downloads;c:~/.config'
# In nnn:
# B - open bookmark
# Then press the shortcut key (h, d, p, etc.)
| Key | Action |
|---|
B or b | Show bookmarks |
Plugins
# Install plugins
curl -Ls https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs | sh
# Plugins are installed to ~/.config/nnn/plugins/
# Set plugin keybindings
export NNN_PLUG='f:finder;o:fzopen;p:preview-tui;d:diffs;t:nmount;v:imgview'
# In nnn, press ; then the plugin key
Essential Plugins
| Plugin | Key | Description |
|---|
preview-tui | p | File preview in terminal |
fzopen | o | Fuzzy open with fzf |
finder | f | Find files with fzf |
diffs | d | Diff two files |
dragdrop | | Drag and drop files |
nmount | t | Mount/unmount drives |
imgview | v | Image viewer |
autojump | | Integration with autojump/zoxide |
Preview Configuration
# Enable file preview with preview-tui plugin
export NNN_PLUG='p:preview-tui'
# Dependencies for preview
# bat (syntax highlighting), pistol or scope.sh
# chafa or catimg (image preview)
# ffmpegthumbnailer (video thumbnails)
# atool (archive preview)
# Use preview: press ; then p
Configuration via Environment Variables
# Add to ~/.bashrc or ~/.zshrc
export NNN_OPTS="deH" # d=detail, e=open in $EDITOR, H=hidden
export NNN_BMS='h:~/;d:~/Documents;p:~/Projects'
export NNN_PLUG='f:finder;o:fzopen;p:preview-tui'
export NNN_FIFO='/tmp/nnn.fifo' # For preview plugin
export NNN_ARCHIVE="\\.(7z|bz2|gz|tar|tgz|zip|zst)$" # Archive patterns
export NNN_FCOLORS='c1e2272e006033f7c6d6abc4' # File colors
export NNN_TRASH=1 # Use trash instead of delete
# Colors (file type colors)
export NNN_FCOLORS='0000E63100000000F7C6D6ABC4'
# Open nnn with configuration
alias n='nnn -deH'
Command Line Options
| Flag | Description |
|---|
-a | Auto NNN_FIFO |
-A | No directory auto-enter |
-b key | Open bookmark key on start |
-c | CLI-only opener |
-C | Color by context |
-d | Detail mode |
-D | Directories in context |
-e | Open text in $EDITOR |
-E | Use $EDITOR for undetected |
-f | Use stdin for selection |
-g | Regex filter |
-H | Show hidden files |
-J | Disable auto-jump on select |
-K | Test for keyboard input |
-n | Nav-as-you-type mode |
-o | Open files only on Enter |
-p file | Copy selection to file |
-P key | Run plugin key on start |
-Q | No quit confirmation |
-r | Show cp/mv progress |
-R | No rollover at edges |
-s name | Session name |
-S | Persistent session |
-t secs | Idle timeout |
-T key | Sort key on start |
-u | Use selection (no prompt) |
-U | Show user/group |
-x | Selection notification |
Advanced Usage
Shell Integration (cd on quit)
# Bash/Zsh function for cd on quit
n() {
if [ -n "$NNNLVL" ] && [ "${NNNLVL:-0}" -ge 1 ]; then
echo "nnn is already running"
return
fi
NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
nnn "$@"
if [ -f "$NNN_TMPFILE" ]; then
. "$NNN_TMPFILE"
rm -f "$NNN_TMPFILE" > /dev/null
fi
}
Batch Rename
# Select files with Space
# Press Ctrl+R to batch rename in $EDITOR
# Modify filenames in editor
# Save and close to apply
Sessions
# Start a named session
nnn -s work
# Resume a session
nnn -s work
# Persistent session (auto-save)
nnn -S
Troubleshooting
| Issue | Solution |
|---|
| No color output | Check terminal color support; set NNN_FCOLORS |
| Plugins not working | Install with getplugs; set NNN_PLUG variable |
| Preview not showing | Install bat, less; set NNN_FIFO; use -a flag |
| Cannot delete files | Set NNN_TRASH=1 for trash; check file permissions |
| cd not working on quit | Use the n() shell function, not raw nnn command |
| Slow on network drives | Use filter to narrow view; avoid -D flag |
| Key bindings differ | Check version; some keys changed between versions |
| Opener not working | Set $VISUAL or $EDITOR; check xdg-open on Linux |