1NNN(1) BSD General Commands Manual NNN(1)
2
4 nnn — The unorthodox terminal file manager.
5
7 nnn [-aAcCdDeEfgHJKnQrRSuUVxh] [-b key] [-F val] [-l val] [-p file]
8 [-P key] [-s name] [-t secs] [-T key] [PATH]
9
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 if PATH is not specified. If PATH
19 is specified and it exists, nnn will open it. If the PATH doesn't exist
20 and ends with a /, nnn will attempt to create the directory tree and open
21 it. Otherwise, PATH is considered a path to a regular file and nnn at‐
22 tempts to create the complete directory tree to the file, open the parent
23 directory and prompt to create the new file in it with the base filename.
24
26 Press ‘?’ in nnn to see the list of keybinds.
27
29 nnn supports the following options:
30
31 -a
32 auto-setup temporary NNN_FIFO (described in ENVIRONMENT section)
33
34 -A
35 disable directory auto-enter on unique filter match
36
37 -b key
38 specify bookmark key to open
39
40 -B
41 use bsdtar for archives (default: atool)
42
43 -c
44 indicates that the opener is a cli-only opener (overrides -e)
45
46 -C
47 8-color scheme - color directories by context, disable file col‐
48 ors
49
50 -d
51 detail mode
52
53 -D
54 show directories in context color with NNN_FCOLORS set
55
56 -e
57 open text files in $VISUAL (else $EDITOR, fallback vi) [prefer‐
58 ably CLI]
59
60 -E
61 use $EDITOR for internal undetached edits
62
63 -f
64 use readline history file
65
66 -F val
67 fifo notification mode
68 0: notify as previewer, 1: notify as explorer
69
70 -g
71 use regex filters instead of substring match
72
73 -H
74 show hidden files
75
76 -i
77 show current file information in info bar (may be slow)
78
79 -J
80 disable auto-advance on selection
81 (eg. selecting an entry will no longer move cursor to the next
82 entry)
83
84 -K
85 test for keybind collision and exit
86
87 -l val
88 number of lines to move per mouse wheel scroll
89
90 -n
91 start in type-to-nav mode
92
93 -o
94 open files only on Enter key
95
96 -p file
97 copy (or pick) selection to file, or stdout if file='-'
98
99 -P key
100 specify plugin key to run
101
102 -Q
103 disable confirmation on quit with multiple contexts active
104
105 -r
106 show cp, mv progress
107 (Linux-only, needs advcpmv; '^T' shows the progress on BSD/macOS)
108
109 -R
110 disable rollover at edges (eg. pressing down while on the last
111 entry will no longer move cursor to the first entry and
112 vice-versa)
113
114 -s name
115 load a session by name
116
117 -S
118 persistent session
119
120 -t secs
121 idle timeout in seconds to lock terminal
122
123 -T key
124 sort order
125 keys: 'a'u / 'd'u / 'e'xtension / 'r'everse / 's'ize / 't'ime /
126 'v'ersion
127 capitalize to reverse (except 'r')
128
129 -u
130 use selection if available, don't prompt to choose between selec‐
131 tion and hovered entry
132
133 -U
134 show user and group names in status bar
135
136 -V
137 show version and exit
138
139 -x
140 show notifications on selection cp, mv, rm completion (requires
141 .ntfy plugin)
142 copy path to system clipboard on selection (requires .cbcp
143 plugin)
144 show xterm title (if non-picker mode)
145
146 -h
147 show program help and exit
148
150 There is no configuration file. Associated files are at
151
152 ${XDG_CONFIG_HOME:-$HOME/.config}/nnn/
153
154 Configuration is done using a few optional (set if you need) environment
155 variables. See ENVIRONMENT section.
156
157 nnn uses xdg-open (on Linux), open(1) (on macOS), cygstart on (Cygwin)
158 and open on (Haiku) as the desktop opener. It's also possible to specify
159 a custom opener. See ENVIRONMENT section.
160
162 Open multiple locations with 4 contexts. The status is shown in the top
163 left corner:
164
165 - the current context is in reverse video
166 - other active contexts are underlined
167 - rest are inactive
168
169 A new context copies the state of the previous context. Each context can
170 have its own color. See ENVIRONMENT section.
171
173 Sessions are a way to save and restore states of work. A session stores
174 the settings and contexts. Sessions can be loaded at runtime or with a
175 program option.
176
177 - When a session is loaded at runtime, the last working state is saved
178 automatically to a dedicated "auto session" session file. Session option
179 restore would restore the "auto session".
180 - The persistent session option is global. If it is used, the last active
181 session will be updated with the final state at program quit.
182 - The "auto session" is used in persistent session mode if no session is
183 active.
184 - Listing input stream and opening a bookmark by key have a higher prior‐
185 ity to session options (-s/-S).
186
187 All the session files are located by session name in the directory
188
189 ${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions
190
191 "@" is the "auto session" file.
192
194 Filters are strings (or regex patterns) to find matching entries in the
195 current directory instantly (search-as-you-type). Matches are case-insen‐
196 sitive by default. The last filter in each context is persisted at run‐
197 time or in saved sessions.
198 When there's a unique match and it's a directory, nnn auto enters the di‐
199 rectory. Use the relevant program option to disable this.
200
201 Special keys at filter prompt:
202
203 -------- + ---------------------------------------
204 Key | Function
205 -------- + ---------------------------------------
206 ^char | Usual keybind functionality
207 Esc | Exit filter prompt but skip dir refresh
208 Alt+Esc | Unfilter, quit context
209 -------- + ---------------------------------------
210
211 Special keys at empty filter prompt:
212
213 ------ + ---------------------------------------
214 Key | Function
215 ------ + ---------------------------------------
216 ? | Show help and config screen
217 / | Toggle between string and regex
218 : | Toggle case-sensitivity
219 ^L | Clear filter (if prompt is non-empty)
220 | OR apply last filter
221 Bksp | Stay at filter prompt and refresh dir
222 Del | Stay at filter prompt and refresh dir
223 ------ + ---------------------------------------
224
225 Common regex use cases:
226
227 (1) To list all matches starting with the filter expression,
228 start the expression with a '^' (caret) symbol.
229 (2) Type '\.mkv' to list all MKV files.
230 (3) Use '.*' to match any character (sort of fuzzy search).
231 (4) Exclude filenames having 'nnn' (compiled with PCRE lib): '^(?!nnn)'
232
233 In the type-to-nav mode directories are opened in filter mode, allowing
234 continuous navigation.
235
236 Additional special keys at empty filter prompt in type-to-nav mode:
237
238 ------ + ------------------------
239 Key | Function
240 ------ + ------------------------
241 ' | Go to first non-dir file
242 + | Toggle file selection
243 , | Mark CWD
244 - | Go to last visited dir
245 . | Show hidden files
246 ; | Run a plugin by its key
247 = | Launch a GUI application
248 > | Export file list
249 @ | Visit start dir
250 ] | Show command prompt
251 ` | Visit /
252 ~ | Go HOME
253 ------ + ------------------------
254
256 nnn allows file selection across directories and contexts!
257
258 There are 3 groups of keybinds to add files to selection:
259
260 (1) hovered file selection toggle
261 - deselects if '+' is visible before the entry, else adds to selec‐
262 tion
263 (2) add a range of files to selection
264 - repeat the range key on the same entry twice to clear selection
265 completely
266 (3) add all files in the current directory to selection
267
268 A selection can be edited, copied, moved, removed, archived or linked.
269
270 Absolute paths of the selected files are copied to .selection file in the
271 config directory. The selection file is shared between multiple program
272 instances. Selection from multiple instances are not merged. The last in‐
273 stance writing to the file overwrites earlier contents. If you have 2 in‐
274 stances of nnn open in 2 panes of a terminal multiplexer, you can select
275 in one pane and use the selection in the other pane. The selection gets
276 cleared in the nnn instance where the selection was made on mv/rm (but
277 not on cp).
278
279 nnn clears the selection after a successful operation with the selection.
280 Plugins are allowed to define the behaviour individually.
281
282 To edit the selection use the _edit selection_ key. Editing doesn't end
283 the selection mode. You can add more files to the selection and edit the
284 list again. If no file is selected in the current session, this option
285 attempts to list the selection file.
286
287 nnn can show the total size of non-filtered selected files listed in a
288 directory. For directories, only the size of the directory is added by
289 default. To add the size of the contents of a directory, switch to du
290 mode.
291
293 There are two ways to search and list:
294
295 - feed a list of file paths as input
296 - search using a plugin (e.g. finder) and list the results
297
298 File paths must be NUL-separated ('\0'). Paths and can be relative to the
299 current directory or absolute. Invalid paths in the input are ignored.
300 Input processing limit is 16,384 paths or 64 MiB (max_paths x
301 max_path_len) of data.
302
303 To list the input stream, start nnn by writing to its standard input.
304 E.g., to list files in current directory larger than 1M:
305
306 find -maxdepth 1 -size +1M -print0 | nnn
307
308 or redirect a list from a file:
309
310 nnn < files.txt
311
312 Handy bash/zsh shell function to list files by mime-type in current di‐
313 rectory:
314
315 # to show video files, run: list video
316
317 list ()
318 {
319 find . -maxdepth 1 | file -if- | grep "$1" | awk -F: '{printf "%s ", $1}' | nnn
320 }
321
322 A temporary directory will be created containing symlinks to the given
323 paths. Any action performed on these symlinks will be performed only on
324 their targets, after which they might become invalid.
325
326 Right arrow or 'l' on a symlink in the listing dir takes to the target
327 file. Press '-' to return to the listing dir. Press 'Enter' to open the
328 symlink.
329
330 Listing input stream can be scripted. It can be extended to pick (option
331 -p) selected entries from the listed results.
332
334 There are 2 ways (can be used together) to manage bookmarks.
335
336 (1) Bookmark keys: See NNN_BMS under ENVIORNMENT section on how to set
337 bookmark keys.
338
339 The select bookmark key b lists all the bookmark keys set in NNN_BMS
340 in the bookmarks prompt.
341
342 (2) Symlinked bookmarks: A symlinked bookmark to the current directory
343 can
344 be created with the B key (or manually under ~/.config/nnn/book‐
345 marks).
346
347 Pressing 'Enter' at the bookmarks prompt takes to this directory.
348 If NNN_BMS is not set, the select bookmark key directly opens it.
349
350 On entering a bookmark, the directory where the select bookmark key was
351 pressed is set as the previous directory. Press '-' to return to it.
352
354 The minimum file size unit is byte (B). The rest are K, M, G, T, P, E, Z,
355 Y (powers of 1024), same as the default units in ls.
356
358 The SHELL, VISUAL (else EDITOR) and PAGER environment variables are used.
359 A single combination of arguments is supported for SHELL and PAGER.
360
361 NNN_OPTS: binary options to nnn
362
363 export NNN_OPTS="cEnrx"
364
365 NNN_OPENER: specify a custom file opener.
366
367 export NNN_OPENER=nuke
368
369 NOTE: 'nuke' is a file opener available in the plugin repository.
370
371 NNN_BMS: bookmark string as key_char:location pairs separated by ;:
372
373 export NNN_BMS="d:$HOME/Docs;u:/home/user/Cam Uploads;D:$HOME/Downloads/"
374
375 These bookmarks are listed in the help and config screen (key ?).
376
377 NNN_PLUG: directly executable plugins as key_char:plugin pairs separated
378 by ;:
379
380 export NNN_PLUG='f:finder;o:fzopen;p:mocplay;d:diffs;t:nmount;v:imgview'
381
382 NOTES:
383 1. To run a plugin directly, press ; followed by the key.
384 2. Alternatively, combine with Alt (i.e. Alt+key).
385 3. To skip directory refresh after running a plugin, prefix with -.
386
387 export NNN_PLUG='p:-plugin'
388
389 To assign keys to arbitrary non-background cli commands and invoke
390 like
391 plugins, add ! before the command.
392
393 export NNN_PLUG='x:!chmod +x "$nnn";g:!git log;s:!smplayer "$nnn"'
394
395 To pick and run an unassigned plugin, press Enter at the plugin prompt.
396 To run a plugin at startup, use the option `-P` followed by the plugin key.
397
398 NOTES:
399 1. Place $nnn (or exported variables) in double quotes ("$nnn")
400 2. Use single quotes for $NNN_PLUG so "$nnn" is not interpreted
401 3. (Again) add ! before the command
402 4. To disable directory refresh after running a command as plugin,
403 prefix with -!
404 5. To skip user confirmation after command execution, suffix with *
405 Note: Do not use * with programs those run and exit e.g. cat
406
407 export NNN_PLUG='y:-!sync*'
408
409 6. To run a GUI app as plugin, add a & after !.
410
411 export NNN_PLUG='m:-!&mousepad "$nnn"'
412
413 7. To show the output of run-and-exit commands which do not need user input,
414 add | (pipe) after !
415 Note: This option is incompatible with & (terminal output is masked
416 for GUI programs) and ignores * (output is already paged for user).
417
418 export NNN_PLUG='m:-!|mediainfo "$nnn";t:-!|tree -ps;l:-!|ls -lah --group-directories-first'
419
420 EXAMPLES:
421 ------------------------------------ + -------------------------------------------------
422 Key:Command | Description
423 ------------------------------------ + -------------------------------------------------
424 c:!convert "$nnn" png:- | xclip | Copy image to clipboard
425 -sel clipboard -t image/png* |
426 C:!cp -rv "$nnn" "$nnn".cp* | Create a copy of the hovered file
427 e:-!sudo -E vim "$nnn"* | Edit file as root in vim
428 g:-!git diff | Show git diff
429 h:-!hx "$nnn"* | Open hovered file in hx hex editor
430 k:-!fuser -kiv "$nnn"* | Interactively kill process(es) using hovered file
431 l:-!git log | Show git log
432 n:-!vi /home/user/Dropbox/dir/note* | Take quick notes in a synced file/dir of notes
433 p:-!less -iR "$nnn"* | Page through hovered file in less
434 s:-!&smplayer -minigui "$nnn" | Play hovered media file, even unfinished download
435 x:!chmod +x "$nnn" | Make the hovered file executable
436 y:-!sync* | Flush cached writes
437 ------------------------------------ + -------------------------------------------------
438
439 Online docs: https://github.com/jarun/nnn/tree/master/plugins
440
441 NNN_ORDER: directory-specific sort key.
442
443 export NNN_ORDER='t:/home/user/Downloads;S:/tmp'
444
445 NOTE: Sort keys can be a/d/e/r/s/t/v (see program option -T).
446 Capitalize to reverse (except 'r').
447 Path must be absolute.
448
449 Timestamps for entries modified/created within 5 minutes are shown in reverse.
450
451 NNN_COLORS: string of color numbers for each context, e.g.:
452
453 # 8 color numbers:
454 # 0-black, 1-red, 2-green, 3-yellow, 4-blue (default), 5-magenta, 6-cyan, 7-white
455 export NNN_COLORS='1234'
456
457 # xterm 256 color numbers (converted to hex, 2 symbols per context):
458 # see https://user-images.githubusercontent.com/1482942/93023823-46a6ba80-f5e1-11ea-9ea3-6a3c757704f4.png
459 export NNN_COLORS='#0a1b2c3d'
460
461 # both (256 followed by 8 as fallback, separated by ';')
462 export NNN_COLORS='#0a1b2c3d;1234'
463
464 NOTE: If only 256 colors are specified and the terminal doesn't support, default is used.
465
466 NNN_FCOLORS: specify file-type specific colors:
467
468 export NNN_FCOLORS='c1e2272e006033f7c6d6abc4'
469
470 Specify file-specific colors in xterm 256 color hex numbers (2 symbols per color).
471 Order is strict, use 00 to omit/use default terminal color. Defaults:
472
473 ------------------------- + --- + -------------
474 Order | Hex | Color
475 ------------------------- + --- + -------------
476 Block device | c1 | DarkSeaGreen1
477 Char device | e2 | Yellow1
478 Directory | 27 | DeepSkyBlue1
479 Executable | 2e | Green1
480 Regular | 00 | Normal
481 Hard link | 60 | Plum4
482 Symbolic link | 33 | Cyan1
483 Missing OR file details | f7 | Grey62
484 Orphaned symbolic link | c6 | DeepPink1
485 FIFO | d6 | Orange1
486 Socket | ab | MediumOrchid1
487 Unknown OR 0B regular/exe | c4 | Red1
488 ------------------------- + --- + -------------
489
490 If the terminal supports xterm 256 colors or more, file-specific colors will be rendered.
491 To force the 8-color scheme use option -C.
492 If xterm 256 colors aren't supported, 8-color scheme will be used.
493
494 NNN_ARCHIVE: archive extensions to be handled silently (default: bzip2,
495 (g)zip, tar).
496
497 export NNN_ARCHIVE="\\.(7z|bz2|gz|tar|tgz|zip)$"
498
499 NOTE: Non-default formats may require a third-party utility.
500
501 NNN_ARCHMNT: optional archive mounter utility (default: archivemount).
502
503 export NNN_ARCHIVE='fuse-archive'
504
505 NNN_SSHFS: specify custom sshfs command with options:
506
507 export NNN_SSHFS='sshfs -o reconnect,idmap=user,cache_timeout=3600'
508
509 NOTE: The options must be comma-separated without any space between them.
510
511 NNN_RCLONE: pass additional options to rclone command:
512
513 export NNN_RCLONE='rclone mount --read-only --no-checksum'
514
515 NOTE: The options must be preceded by "rclone" and max 5 flags are supported.
516
517 NNN_TRASH: trash (instead of rm -rf) files to desktop Trash.
518
519 export NNN_TRASH=n
520 # n=1: trash-cli, n=2: gio trash
521
522 NNN_SEL: absolute path to custom selection file.
523
524 export NNN_SEL='/tmp/.sel'
525
526 NNN_FIFO: path of a named pipe to write the hovered file path:
527
528 export NNN_FIFO='/tmp/nnn.fifo'
529
530 NOTES:
531 1. Overridden by a temporary path with -a option.
532 2. If the FIFO file doesn't exist it will be created,
533 but not removed (unless it is generated by -a option).
534
535 Online docs: https://github.com/jarun/nnn/wiki/Live-previews
536
537 NNN_LOCKER: terminal locker program.
538
539 export NNN_LOCKER='bmon -p wlp1s0'
540 export NNN_LOCKER='cmatrix'
541
542 NNN_TMPFILE: always cd on quit and write the command in the file speci‐
543 fied.
544
545 export NNN_TMPFILE='/tmp/.lastd'
546
547 NNN_HELP: run a program and show the output on top of the program help
548 page.
549
550 export NNN_HELP='fortune'
551
552 NNN_MCLICK: key emulated by a middle mouse click.
553
554 export NNN_MCLICK='^R'
555
556 NOTE: Only the first character is considered if not a Ctrl+key combo.
557
558 nnn: this is a special variable.
559
560 Set to the hovered file name before starting the command prompt or spawning a shell.
561
562 NO_COLOR: disable ANSI color output (overridden by NNN_COLORS).
563
565 Arun Prakash Jana <engineerarun@gmail.com>,
566 Lazaros Koromilas <lostd@2f30.org>,
567 Dimitris Papastamos <sin@2f30.org>.
568
570 https://github.com/jarun/nnn
571
572BSD Aug 27, 2023 BSD