1NNN(1)                    BSD General Commands Manual                   NNN(1)
2

NAME

4     nnn — The unorthodox terminal file manager.
5

SYNOPSIS

7     nnn [-aAcCdDeEfgHJKnQrRSuUVxh] [-b key] [-F val] [-l val] [-p file]
8         [-P key] [-s name] [-t secs] [-T key] [PATH]
9

DESCRIPTION

11     nnn (Nnn's Not Noice) is a performance-optimized, feature-packed fork of
12     noice http://git.2f30.org/noice/ with seamless desktop integration, sim‐
13     plified navigation, type-to-nav mode with dir auto-enter, disk usage ana‐
14     lyzer mode, bookmarks, contexts, application launcher, familiar naviga‐
15     tion shortcuts, subshell spawning and much more. It remains a simple and
16     efficient file manager that stays out of your way.
17
18     nnn opens the current working directory by default if PATH is not speci‐
19     fied.
20

KEYBINDS

22     Press ‘?’ in nnn to see the list of keybinds.
23

OPTIONS

25     nnn supports the following options:
26
27     -a
28             auto-setup temporary NNN_FIFO (described in ENVIRONMENT section)
29
30     -A
31             disable directory auto-enter on unique filter match
32
33     -b key
34             specify bookmark key to open
35
36     -B
37             use bsdtar for archives (default: atool)
38
39     -c
40             indicates that the opener is a cli-only opener (overrides -e)
41
42     -C
43             8-color scheme - color directories by context, disable file col‐
44     ors
45
46     -d
47             detail mode
48
49     -D
50             show directories in context color with NNN_FCOLORS set
51
52     -e
53             open text files in $VISUAL (else $EDITOR, fallback vi) [prefer‐
54     ably CLI]
55
56     -E
57             use $EDITOR for internal undetached edits
58
59     -f
60             use readline history file
61
62     -F val
63             fifo notification mode
64             0: notify as previewer, 1: notify as explorer
65
66     -g
67             use regex filters instead of substring match
68
69     -H
70             show hidden files
71
72     -i
73             show current file information in info bar (may be slow)
74
75     -J
76             disable auto-advance on selection
77             (eg. selecting an entry will no longer move cursor to the next
78     entry)
79
80     -K
81             test for keybind collision and exit
82
83     -l val
84             number of lines to move per mouse wheel scroll
85
86     -n
87             start in type-to-nav mode
88
89     -o
90             open files only on Enter key
91
92     -p file
93             copy (or pick) selection to file, or stdout if file='-'
94
95     -P key
96             specify plugin key to run
97
98     -Q
99             disable confirmation on quit with multiple contexts active
100
101     -r
102             show cp, mv progress
103             (Linux-only, needs advcpmv; '^T' shows the progress on BSD/macOS)
104
105     -R
106             disable rollover at edges (eg. pressing down while on the last
107             entry will no longer move cursor to the first entry and
108     vice-versa)
109
110     -s name
111             load a session by name
112
113     -S
114             persistent session
115
116     -t secs
117             idle timeout in seconds to lock terminal
118
119     -T key
120             sort order
121             keys: 'a'u / 'd'u / 'e'xtension / 'r'everse / 's'ize / 't'ime /
122     'v'ersion
123             capitalize to reverse (except 'r')
124
125     -u
126             use selection if available, don't prompt to choose between selec‐
127     tion and hovered entry
128
129     -U
130             show user and group names in status bar
131
132     -V
133             show version and exit
134
135     -x
136             show notifications on selection cp, mv, rm completion (requires
137     .ntfy plugin)
138             copy path to system clipboard on selection (requires .cbcp
139     plugin)
140             show xterm title (if non-picker mode)
141
142     -h
143             show program help and exit
144

CONFIGURATION

146     There is no configuration file. Associated files are at
147
148     ${XDG_CONFIG_HOME:-$HOME/.config}/nnn/
149
150     Configuration is done using a few optional (set if you need) environment
151     variables. See ENVIRONMENT section.
152
153     nnn uses xdg-open (on Linux), open(1) (on macOS), cygstart on (Cygwin)
154     and open on (Haiku) as the desktop opener. It's also possible to specify
155     a custom opener. See ENVIRONMENT section.
156

CONTEXTS

158     Open multiple locations with 4 contexts. The status is shown in the top
159     left corner:
160
161     - the current context is in reverse video
162     - other active contexts are underlined
163     - rest are inactive
164
165     A new context copies the state of the previous context. Each context can
166     have its own color. See ENVIRONMENT section.
167

SESSIONS

169     Sessions are a way to save and restore states of work. A session stores
170     the settings and contexts. Sessions can be loaded at runtime or with a
171     program option.
172
173     - When a session is loaded at runtime, the last working state is saved
174     automatically to a dedicated "auto session" session file. Session option
175     restore would restore the "auto session".
176     - The persistent session option is global. If it is used, the last active
177     session will be updated with the final state at program quit.
178     - The "auto session" is used in persistent session mode if no session is
179     active.
180     - Listing input stream and opening a bookmark by key have a higher prior‐
181     ity to session options (-s/-S).
182
183     All the session files are located by session name in the directory
184
185     ${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions
186
187     "@" is the "auto session" file.
188

FILTERS

190     Filters are strings (or regex patterns) to find matching entries in the
191     current directory instantly (search-as-you-type). Matches are case-insen‐
192     sitive by default. The last filter in each context is persisted at run‐
193     time or in saved sessions.
194     When there's a unique match and it's a directory, nnn auto enters the di‐
195     rectory. Use the relevant program option to disable this.
196
197     Special keys at filter prompt:
198
199     -------- + ---------------------------------------
200       Key    |                Function
201     -------- + ---------------------------------------
202      ^char   | Usual keybind functionality
203      Esc     | Exit filter prompt but skip dir refresh
204      Alt+Esc | Unfilter, quit context
205     -------- + ---------------------------------------
206
207     Special keys at empty filter prompt:
208
209     ------ + ---------------------------------------
210       Key  |                Function
211     ------ + ---------------------------------------
212        ?   | Show help and config screen
213        /   | Toggle between string and regex
214        :   | Toggle case-sensitivity
215       ^L   | Clear filter (if prompt is non-empty)
216            | OR apply last filter
217       Bksp | Stay at filter prompt and refresh dir
218       Del  | Stay at filter prompt and refresh dir
219     ------ + ---------------------------------------
220
221     Common regex use cases:
222
223     (1) To list all matches starting with the filter expression,
224         start the expression with a '^' (caret) symbol.
225     (2) Type '\.mkv' to list all MKV files.
226     (3) Use '.*' to match any character (sort of fuzzy search).
227     (4) Exclude filenames having 'nnn' (compiled with PCRE lib): '^(?!nnn)'
228
229     In the type-to-nav mode directories are opened in filter mode, allowing
230     continuous navigation.
231
232     Additional special keys at empty filter prompt in type-to-nav mode:
233
234     ------ + ------------------------
235       Key  |         Function
236     ------ + ------------------------
237        '   | Go to first non-dir file
238        +   | Toggle file selection
239        ,   | Mark CWD
240        -   | Go to last visited dir
241        .   | Show hidden files
242        ;   | Run a plugin by its key
243        =   | Launch a GUI application
244        >   | Export file list
245        @   | Visit start dir
246        ]   | Show command prompt
247        `   | Visit /
248        ~   | Go HOME
249     ------ + ------------------------
250

SELECTION

252     nnn allows file selection across directories and contexts!
253
254     There are 3 groups of keybinds to add files to selection:
255
256     (1) hovered file selection toggle
257         - deselects if '+' is visible before the entry, else adds to selec‐
258     tion
259     (2) add a range of files to selection
260         - repeat the range key on the same entry twice to clear selection
261     completely
262     (3) add all files in the current directory to selection
263
264     A selection can be edited, copied, moved, removed, archived or linked.
265
266     Absolute paths of the selected files are copied to .selection file in the
267     config directory. The selection file is shared between multiple program
268     instances. Selection from multiple instances are not merged. The last in‐
269     stance writing to the file overwrites earlier contents. If you have 2 in‐
270     stances of nnn open in 2 panes of a terminal multiplexer, you can select
271     in one pane and use the selection in the other pane. The selection gets
272     cleared in the nnn instance where the selection was made on mv/rm (but
273     not on cp).
274
275     nnn clears the selection after a successful operation with the selection.
276     Plugins are allowed to define the behaviour individually.
277
278     To edit the selection use the _edit selection_ key. Editing doesn't end
279     the selection mode. You can add more files to the selection and edit the
280     list again. If no file is selected in the current session, this option
281     attempts to list the selection file.
282

FIND AND LIST

284     There are two ways to search and list:
285
286     - feed a list of file paths as input
287     - search using a plugin (e.g. finder) and list the results
288
289     File paths must be NUL-separated ('\0'). Paths and can be relative to the
290     current directory or absolute. Invalid paths in the input are ignored.
291     Input processing limit is 16,384 paths or 64 MiB (max_paths x
292     max_path_len) of data.
293
294     To list the input stream, start nnn by writing to its standard input.
295     E.g., to list files in current directory larger than 1M:
296
297         find -maxdepth 1 -size +1M -print0 | nnn
298
299     or redirect a list from a file:
300
301         nnn < files.txt
302
303     Handy bash/zsh shell function to list files by mime-type in current di‐
304     rectory:
305
306         # to show video files, run: list video
307
308         list ()
309         {
310             find . -maxdepth 1 | file -if- | grep "$1" | awk -F: '{printf "%s ", $1}' | nnn
311         }
312
313     A temporary directory will be created containing symlinks to the given
314     paths. Any action performed on these symlinks will be performed only on
315     their targets, after which they might become invalid.
316
317     Right arrow or 'l' on a symlink in the listing dir takes to the target
318     file. Press '-' to return to the listing dir. Press 'Enter' to open the
319     symlink.
320
321     Listing input stream can be scripted. It can be extended to pick (option
322     -p) selected entries from the listed results.
323

BOOKMARKS

325     There are 2 ways (can be used together) to manage bookmarks.
326
327     (1) Bookmark keys: See NNN_BMS under ENVIORNMENT section on how to set
328         bookmark keys.
329
330         The select bookmark key b lists all the bookmark keys set in NNN_BMS
331         in the bookmarks prompt.
332
333     (2) Symlinked bookmarks: A symlinked bookmark to the current directory
334     can
335         be created with the B key (or manually under ~/.config/nnn/book‐
336     marks).
337
338         Pressing 'Enter' at the bookmarks prompt takes to this directory.
339         If NNN_BMS is not set, the select bookmark key directly opens it.
340
341     On entering a bookmark, the directory where the select bookmark key was
342     pressed is set as the previous directory. Press '-' to return to it.
343

UNITS

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

ENVIRONMENT

349     The SHELL, VISUAL (else EDITOR) and PAGER environment variables are used.
350     A single combination of arguments is supported for SHELL and PAGER.
351
352     NNN_OPTS: binary options to nnn
353
354         export NNN_OPTS="cEnrx"
355
356     NNN_OPENER: specify a custom file opener.
357
358         export NNN_OPENER=nuke
359
360         NOTE: 'nuke' is a file opener available in the plugin repository.
361
362     NNN_BMS: bookmark string as key_char:location pairs separated by ;:
363
364         export NNN_BMS="d:$HOME/Docs;u:/home/user/Cam Uploads;D:$HOME/Downloads/"
365
366     These bookmarks are listed in the help and config screen (key ?).
367
368     NNN_PLUG: directly executable plugins as key_char:plugin pairs separated
369     by ;:
370
371         export NNN_PLUG='f:finder;o:fzopen;p:mocplay;d:diffs;t:nmount;v:imgview'
372
373         NOTES:
374         1. To run a plugin directly, press ; followed by the key.
375         2. Alternatively, combine with Alt (i.e. Alt+key).
376         3. To skip directory refresh after running a plugin, prefix with -.
377
378         export NNN_PLUG='p:-plugin'
379
380         To assign keys to arbitrary non-background cli commands and invoke
381     like
382         plugins, add ! before the command.
383
384         export NNN_PLUG='x:!chmod +x $nnn;g:!git log;s:!smplayer $nnn'
385
386         To pick and run an unassigned plugin, press Enter at the plugin prompt.
387         To run a plugin at startup, use the option `-P` followed by the plugin key.
388
389         NOTES:
390         1. Use single quotes for $NNN_PLUG so $nnn is not interpreted
391         2. $nnn must be the last argument (if used) to run a command as plugin
392         3. (Again) add ! before the command
393         4. To disable directory refresh after running a command as plugin,
394            prefix with -!
395         5. To skip user confirmation after command execution, suffix with *
396            Note: Do not use * with programs those run and exit e.g. cat
397
398             export NNN_PLUG='y:-!sync*'
399
400         6. To run a GUI app as plugin, add a & after !
401            Note: $nnn must be the last argument in this case.
402
403             export NNN_PLUG='m:-!&mousepad $nnn'
404
405         7. To show the output of run-and-exit commands which do not need user input,
406            add | (pipe) after !
407            Note: This option is incompatible with & (terminal output is masked
408            for GUI programs) and ignores * (output is already paged for user)
409
410             export NNN_PLUG='m:-!|mediainfo $nnn;t:-!|tree -ps;l:-!|ls -lah --group-directories-first'
411
412         EXAMPLES:
413         ------------------------------------ + -------------------------------------------------
414                     Key:Command              |                   Description
415         ------------------------------------ + -------------------------------------------------
416         c:!convert $nnn png:- | xclip -sel  | Copy image to clipboard
417            clipboard -t image/png*           |
418         e:-!sudo -E vim $nnn*                | Edit file as root in vim
419         g:-!git diff                         | Show git diff
420         h:-!hx $nnn*                         | Open hovered file in hx hex editor
421         k:-!fuser -kiv $nnn*                 | Interactively kill process(es) using hovered file
422         l:-!git log                          | Show git log
423         n:-!vi /home/user/Dropbox/dir/note*  | Take quick notes in a synced file/dir of notes
424         p:-!less -iR $nnn*                   | Page through hovered file in less
425         s:-!&smplayer -minigui $nnn          | Play hovered media file, even unfinished download
426         x:!chmod +x $nnn                     | Make the hovered file executable
427         y:-!sync*                            | Flush cached writes
428         ------------------------------------ + -------------------------------------------------
429
430         Online docs: https://github.com/jarun/nnn/tree/master/plugins
431
432     NNN_ORDER: directory-specific sort key.
433
434         export NNN_ORDER='t:/home/user/Downloads;S:/tmp'
435
436         NOTE: Sort keys can be a/d/e/r/s/t/v (see program option -T).
437               Capitalize to reverse (except 'r').
438               Path must be absolute.
439
440               Timestamps for entries modified/created within 5 minutes are shown in reverse.
441
442     NNN_COLORS: string of color numbers for each context, e.g.:
443
444         # 8 color numbers:
445         # 0-black, 1-red, 2-green, 3-yellow, 4-blue (default), 5-magenta, 6-cyan, 7-white
446         export NNN_COLORS='1234'
447
448         # xterm 256 color numbers (converted to hex, 2 symbols per context):
449         # see https://user-images.githubusercontent.com/1482942/93023823-46a6ba80-f5e1-11ea-9ea3-6a3c757704f4.png
450         export NNN_COLORS='#0a1b2c3d'
451
452         # both (256 followed by 8 as fallback, separated by ';')
453         export NNN_COLORS='#0a1b2c3d;1234'
454
455         NOTE: If only 256 colors are specified and the terminal doesn't support, default is used.
456
457     NNN_FCOLORS: specify file-type specific colors:
458
459         export NNN_FCOLORS='c1e2272e006033f7c6d6abc4'
460
461         Specify file-specific colors in xterm 256 color hex numbers (2 symbols per color).
462         Order is strict, use 00 to omit/use default terminal color. Defaults:
463
464         ------------------------- + --- + -------------
465                   Order           | Hex |    Color
466         ------------------------- + --- + -------------
467         Block device              | c1  | DarkSeaGreen1
468         Char device               | e2  | Yellow1
469         Directory                 | 27  | DeepSkyBlue1
470         Executable                | 2e  | Green1
471         Regular                   | 00  | Normal
472         Hard link                 | 60  | Plum4
473         Symbolic link             | 33  | Cyan1
474         Missing OR file details   | f7  | Grey62
475         Orphaned symbolic link    | c6  | DeepPink1
476         FIFO                      | d6  | Orange1
477         Socket                    | ab  | MediumOrchid1
478         Unknown OR 0B regular/exe | c4  | Red1
479         ------------------------- + --- + -------------
480
481         If the terminal supports xterm 256 colors or more, file-specific colors will be rendered.
482         To force the 8-color scheme use option -C.
483         If xterm 256 colors aren't supported, 8-color scheme will be used.
484
485     NNN_ARCHIVE: archive extensions to be handled silently (default: bzip2,
486     (g)zip, tar).
487
488         export NNN_ARCHIVE="\\.(7z|bz2|gz|tar|tgz|zip)$"
489
490         NOTE: Non-default formats may require a third-party utility.
491
492     NNN_SSHFS: specify custom sshfs command with options:
493
494         export NNN_SSHFS='sshfs -o reconnect,idmap=user,cache_timeout=3600'
495
496         NOTE: The options must be comma-separated without any space between them.
497
498     NNN_RCLONE: pass additional options to rclone command:
499
500         export NNN_RCLONE='rclone mount --read-only --no-checksum'
501
502         NOTE: The options must be preceded by "rclone" and max 5 flags are supported.
503
504     NNN_TRASH: trash (instead of rm -rf) files to desktop Trash.
505
506         export NNN_TRASH=n
507         # n=1: trash-cli, n=2: gio trash
508
509     NNN_SEL: absolute path to custom selection file.
510
511     NNN_FIFO: path of a named pipe to write the hovered file path:
512
513         export NNN_FIFO='/tmp/nnn.fifo'
514
515         NOTES:
516         1. Overridden by a temporary path with -a option.
517         2. If the FIFO file doesn't exist it will be created,
518            but not removed (unless it is generated by -a option).
519
520         Online docs: https://github.com/jarun/nnn/wiki/Live-previews
521
522     NNN_LOCKER: terminal locker program.
523
524         export NNN_LOCKER='bmon -p wlp1s0'
525         export NNN_LOCKER='cmatrix'
526
527     NNN_TMPFILE: always cd on quit and write the command in the file speci‐
528     fied.
529
530         export NNN_TMPFILE='/tmp/.lastd'
531
532     NNN_HELP: run a program and show the output on top of the program help
533     page.
534
535         export NNN_HELP='fortune'
536
537     NNN_MCLICK: key emulated by a middle mouse click.
538
539         export NNN_MCLICK='^R'
540
541         NOTE: Only the first character is considered if not a Ctrl+key combo.
542
543     nnn: this is a special variable.
544
545         Set to the hovered file name before starting the command prompt or spawning a shell.
546
547     NO_COLOR: disable ANSI color output (overridden by NNN_COLORS).
548

AUTHORS

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

HOME

555     https://github.com/jarun/nnn
556
557BSD                              Nov 24, 2022                              BSD
Impressum