NNN(1)

NAME
nnn - the missing terminal file manager for X

SYNOPSIS
nnn [-a] [-A] [-b key] [-c] [-d] [-e] [-E] [-g] [-H] [-K] [-n] [-p file] [-Q] [-r] [-R] [-s name] [-S] [-t secs] [-v] [-V] [-x] [-h] [PATH]

DESCRIPTION
nnn (Nnn's Not Noice) is a performance-optimized, feature-packed fork of noice (http://git.2f30.org/noice/) with seamless desktop integration, simplified navigation, navigate-as-you-type mode with auto select, disk usage analyzer mode, bookmarks, contexts, application launcher, familiar navigation shortcuts, subshell spawning and much more.It remains a simple and efficient file manager that stays out of your way.

nnn opens the current working directory by default if PATH is not specified.

KEYBINDS

Press ? in nnn to see the list of keybinds.

OPTIONS

nnn supports the following options:

-a use access time for all operations (default: modification time)

-A disable directory auto-select in navigate-as-you-type mode

-b key specify bookmark key to open

-c opener opens files in cli utilities only (overrides -e)

-d detail mode

-e open text files in $VISUAL (else $EDITOR, fallback vi) [preferably CLI]

-E use $EDITOR for internal undetached edits

-g use regex filters instead of substring match

-H show hidden files

-K test for keybind collision

-n start in navigate-as-you-type mode

-o open files only on Enter key

-p file copy (or pick) selection to file, or stdout if file='-'

-Q disable confirmation on quit with multiple contexts active

-r show cp, mv progress (Linux-only, needs advcpmv; '^T' shows the progress on BSD/macOS)

-R disable rollover at edges

-s name load a session by name

-S start in disk usage analyzer mode

-t secs idle timeout in seconds to lock terminal

-v use case-insensitive version compare to sort files

-V show version and exit

-x show notis on selection cp, mv, rm completion copy path to system clipboard on select

-h show program help and exit

CONFIGURATION
There is no configuration file. Associated files are at

${XDG_CONFIG_HOME:-$HOME/.config}/nnn/

Configuration is done using a few optional (set if you need) environment variables. See ENVIRONMENT section.

nnn uses xdg-open (on Linux), open(1) (on macOS), cygstart on (Cygwin) and open on (Haiku) as the desktop opener. It's also possible to specify a custom opener. See ENVIRONMENT section.

CONTEXTS
Contexts serve the purpose of exploring multiple directories simultaneously. 4 contexts are available. The status of the contexts are shown in the top left corner:

- the current context is in reverse video
- other active contexts are underlined
- rest are inactive

On context creation, the state of the previous context is copied. Each context remembers its last visited directory.

Each context can have its own directory color specified. See ENVIRONMENT section.

SESSIONS
Sessions are a way to save and restore states of work. A session stores the settings and contexts.

Sessions can be loaded dynamically from within a running nnn instance, or with a program option.

When a session is loaded dynamically, the last working session is saved automatically to a dedicated -- "last session" -- session file.

All the session files are located by session name in the directory

${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions

"@" is the "last session" file.

FILTERS
Filters are strings to find matching entries in the current directory instantly (search-as-you-type). There is a program option to switch to regex filters. Matches are case-insensitive by default. In each context the last filter is persisted at runtime or in saved sessions.

Special keys at empty filter prompt:

- toggle between string and regex: '/'
- toggle case sensitivity: ':'
- apply the last filter (or clear filter if non-empty): '^L'
- show help and config screen: '?'
- show command prompt: ']'
- launch an application: '='
- run a plugin by its key: ';'
- pin current directory: ','

Other noteworthy keys:

- '^char': usual keybind functionality
- 'Esc': exit filter prompt but skip dir refresh

Common regex use cases:

(1) To list all matches starting with the filter expression, start the expression with a '^' (caret) symbol.
(2) Type '\.mkv' to list all MKV files.
(3) Use '.*' to match any character (sort of fuzzy search).

In the navigate-as-you-type mode directories are opened in filter mode, allowing continuous navigation. Works best with the arrow keys.
When there's a unique match and it's a directory, nnn auto selects the directory and enters it in this mode. Use the relevant program option to disable this behaviour.

SELECTION
nnn allows file selection across directories and contexts!

There are 3 groups of keybinds to add files to selection:

(1) hovered file selection toggle (deselects if '+' is visible before the entry, else adds to selection)
(2) add a range of files to selection (repeat the range key on the same entry twice to clear selection completely)
(3) add all files in the current directory to selection

A selection can be edited, copied, moved, removed, archived or linked.

Absolute paths of the selected files are copied to .selection file in the config directory.

To edit the selection use the _edit selection_ key. Use this key to remove a file from selection after you navigate away from its directory. Editing doesn't end the selection mode. You can add more files to the selection and edit the list again. If no file is selected in the current session, this option attempts to list the selection file.

LIST FILES
nnn can receive a list of files as input. The paths should be NUL-separated ('\0') but doesn't need to be NUL-terminated. Paths and can be relative to the current directory or absolute.

Input is limited by 65,536 paths or 256 MiB of input.

Start nnn in this mode by writing to its standard input. So the output of another command can be piped to it. For example, to list files in current directory larger than 1M:

        find -maxdepth 1 -size +1M -print0 | nnn

or you can redirect a list from a file:

        nnn < files.txt

A temporary directory will be created containing symlinks to the given paths. Any action performed on these symlinks will be performed only on their targets, after which they might become invalid.

Though the term "files" is used, any input is valid as long as it's a valid path. Invalid paths are ignored.

UNITS
The minimum file size unit is byte (B). The rest are K, M, G, T, P, E, Z, Y (powers of 1024), same as the default units in ls.

ENVIRONMENT
The SHELL, EDITOR (VISUAL, if defined) and PAGER environment variables are used. A single combination of arguments is supported for SHELL and PAGER.

NNN_OPENER: specify a custom file opener.

        export NNN_OPENER=nuke
        NOTE: `nuke` is a file opener available in plugin repository

NNN_BMS: bookmark string as key_char:location pairs (max 10) separated by ;:

        export NNN_BMS='d:~/Documents;u:/home/user/Cam Uploads;D:~/Downloads/'
        NOTE: To go to a bookmark, press the Lead key followed by the bookmark key.

NNN_PLUG: directly executable plugins as key_char:location pairs (max 15) separated by ;:

        export NNN_PLUG='o:fzopen;p:mocplay;d:diffs;m:nmount;t:imgthumb'
        NOTES:
        1. To run a plugin directly, press ; followed by the plugin key
        2. To skip directory refresh after running a plugin, prefix with -
        export NNN_PLUG='m:-mediainfo'

To assign keys to arbitrary non-background non-shell-interpreted cli commands and invoke like plugins, add _ (underscore) before the command.

        export NNN_PLUG='x:_chmod +x $nnn;g:_git log;s:_smplayer $nnn;o:fzopen'
        NOTES:
        1. Use single quotes for $NNN_PLUG so $nnn is not interpreted
        2. $nnn should be the last argument (IF used)
        3. (Again) add _ before the command
        4. To disable directory refresh after running a command as plugin,
           prefix with -_
        5. To skip user confirmation after command execution, suffix with *
        export NNN_PLUG='y:-_sync*'
        6. To run a GUI app as plugin, add a | after _
        export NNN_PLUG='m:-_|mousepad $nnn'
        EXAMPLES:
        ----------------------------------- + -------------------------------------------------
                    Key:Command             |                   Description
        ----------------------------------- + -------------------------------------------------
        k:-_fuser -kiv $nnn*                | Interactively kill process(es) using hovered file
        l:_git log                          | Show git log
        n:-_vi /home/user/Dropbox/dir/note* | Take quick notes in a synced file/dir of notes
        p:-_less -iR $nnn*                  | Page through hovered file in less
        s:-_|smplayer -minigui $nnn         | Play hovered media file, even unfinished download
        x:_chmod +x $nnn                    | Make the hovered file executable
        y:-_sync*                           | Flush cached writes
        ----------------------------------- + -------------------------------------------------

NNN_COLORS: string of color codes for each context, e.g.:

        export NNN_COLORS='1234'
        codes: 0-black, 1-red, 2-green, 3-yellow, 4-blue (default), 5-magenta, 6-cyan, 7-white

NNN_SSHFS: pass additional options to sshfs command:

        export NNN_SSHFS='sshfs -o reconnect,idmap=user,cache_timeout=3600'
        NOTE: The options must be preceded by `sshfs` and comma-separated without any space between them.

NNN_RCLONE: pass additional options to rclone command:

        export NNN_RCLONE='rclone mount --read-only --no-checksum'
        NOTE: The options must be preceded by `rclone` and max 5 flags are supported.

NNN_TRASH: trash (instead of delete) files to desktop Trash.

        export NNN_TRASH=1

nnn: this is a special variable set to the hovered entry before executing a command from the command prompt or spawning a shell.

KNOWN ISSUES
nnn may not handle keypresses correctly when used with tmux (see issue #104 for more details). Set TERM=xterm-256color to address it.

AUTHORS
Arun Prakash Jana <engineerarun@gmail.com>, Lazaros Koromilas <lostd@2f30.org>, Dimitris Papastamos <sin@2f30.org>.

HOME
https://github.com/jarun/nnn