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

NAME

4     nnn — The unorthodox terminal file manager.
5

SYNOPSIS

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

CONFIGURATION

137     There is no configuration file. Associated files are at
138
139     ${XDG_CONFIG_HOME:-$HOME/.config}/nnn/
140
141     Configuration is done using a few optional (set if you need) environment
142     variables. See ENVIRONMENT section.
143
144     nnn uses xdg-open (on Linux), open(1) (on macOS), cygstart on (Cygwin)
145     and open on (Haiku) as the desktop opener. It's also possible to specify
146     a custom opener. See ENVIRONMENT section.
147

CONTEXTS

149     Open multiple locations with 4 contexts. The status is shown in the top
150     left corner:
151
152     - the current context is in reverse video
153     - other active contexts are underlined
154     - rest are inactive
155
156     A new context copies the state of the previous context. Each context can
157     have its own color. See ENVIRONMENT section.
158

SESSIONS

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

FILTERS

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

SELECTION

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

FIND AND LIST

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

UNITS

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

ENVIRONMENT

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

AUTHORS

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

HOME

519     https://github.com/jarun/nnn
520
521BSD                              Sep 29, 2021                              BSD
Impressum