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