1NNN(1) BSD General Commands Manual NNN(1)
2
4 nnn — The unorthodox terminal file manager.
5
7 nnn [-a] [-A] [-b key] [-c] [-C] [-d] [-D] [-e] [-E] [-f] [-F] [-g] [-H]
8 [-J] [-K] [-l] [-n] [-p file] [-P key] [-Q] [-r] [-R] [-s name] [-S]
9 [-t secs] [-T key] [-u] [-U] [-V] [-w] [-x] [-h] [PATH]
10
12 nnn (Nnn's Not Noice) is a performance-optimized, feature-packed fork of
13 noice (http://git.2f30.org/noice/) with seamless desktop integration,
14 simplified navigation, type-to-nav mode with auto select, disk usage ana‐
15 lyzer mode, bookmarks, contexts, application launcher, familiar naviga‐
16 tion shortcuts, subshell spawning and much more. It remains a simple and
17 efficient file manager that stays out of your way.
18
19 nnn opens the current working directory by default if PATH is not speci‐
20 fied.
21
23 Press ? in nnn to see the list of keybinds.
24
26 nnn supports the following options:
27
28 -a
29 auto-setup temporary NNN_FIFO (described in ENVIRONMENT section)
30
31 -A
32 disable directory auto-select in type-to-nav mode
33
34 -b key
35 specify bookmark key to open
36
37 -c
38 indicates that the opener is a cli-only opener (overrides -e)
39
40 -C
41 earlier colorscheme - color directories by context, disable file
42 colors
43
44 -d
45 detail mode
46
47 -D
48 show directories in context color with NNN_FCOLORS set
49
50 -e
51 open text files in $VISUAL (else $EDITOR, fallback vi) [prefer‐
52 ably CLI]
53
54 -E
55 use $EDITOR for internal undetached edits
56
57 -f
58 use readline history file
59
60 -F
61 show fortune in help and settings screen
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
114 -u
115 use selection if available, don't prompt to choose between selec‐
116 tion and hovered entry
117
118 -U
119 show user and group names in status bar
120
121 -V
122 show version and exit
123
124 -w
125 place hardware cursor on hovered entry
126
127 -x
128 show notis on selection cp, mv, rm completion
129 copy path to system clipboard on select
130
131 -h
132 show program help and exit
133
135 There is no configuration file. Associated files are at
136
137 ${XDG_CONFIG_HOME:-$HOME/.config}/nnn/
138
139 Configuration is done using a few optional (set if you need) environment
140 variables. See ENVIRONMENT section.
141
142 nnn uses xdg-open (on Linux), open(1) (on macOS), cygstart on (Cygwin)
143 and open on (Haiku) as the desktop opener. It's also possible to specify
144 a custom opener. See ENVIRONMENT section.
145
147 Open multiple locations with 4 contexts. The status is shown in the top
148 left corner:
149
150 - the current context is in reverse video
151 - other active contexts are underlined
152 - rest are inactive
153
154 A new context copies the state of the previous context. Each context can
155 have its own color. See ENVIRONMENT section.
156
158 Sessions are a way to save and restore states of work. A session stores
159 the settings and contexts.
160
161 Sessions can be loaded dynamically at runtime or with a program option.
162
163 When a session is loaded dynamically, the last working session is saved
164 automatically to a dedicated -- "last session" -- session file. The "last
165 session" is also used in persistent session mode.
166
167 Listing input stream has a higher priority to session options (-s/-S).
168 Sessions can be loaded explicitly at runtime. Session option restore
169 would restore the persistent session at runtime.
170
171 All the session files are located by session name in the directory
172
173 ${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions
174
175 "@" is the "last session" file.
176
178 Filters are strings (or regex patterns) to find matching entries in the
179 current directory instantly (search-as-you-type). Matches are case-insen‐
180 sitive by default. The last filter in each context is persisted at run‐
181 time or in saved sessions.
182
183 Special keys at filter prompt:
184
185 -------- + ---------------------------------------
186 Key | Function
187 -------- + ---------------------------------------
188 ^char | Usual keybind functionality
189 Esc | Exit filter prompt but skip dir refresh
190 Alt+Esc | Exit filter prompt and refresh dir
191 -------- + ---------------------------------------
192
193 Special keys at empty filter prompt:
194
195 ------ + ---------------------------------------
196 Key | Function
197 ------ + ---------------------------------------
198 ? | Show help and config screen
199 / | Toggle between string and regex
200 : | Toggle case-sensitivity
201 ^L | Clear filter (if prompt is non-empty)
202 | OR apply last filter
203 ------ + ---------------------------------------
204
205 Additional special keys at empty filter prompt in type-to-nav mode:
206
207 ------ + ------------------------
208 Key | Function
209 ------ + ------------------------
210 ' | Go to first non-dir file
211 + | Toggle auto-advance
212 , | Mark CWD
213 - | Go to last visited dir
214 . | Show hidden files
215 ; | Run a plugin by its key
216 = | Launch a GUI application
217 > | Export file list
218 @ | Visit start dir
219 ] | Show command prompt
220 ` | Visit /
221 ~ | Go HOME
222 ------ + ------------------------
223
224 Common regex use cases:
225
226 (1) To list all matches starting with the filter expression,
227 start the expression with a '^' (caret) symbol.
228 (2) Type '\.mkv' to list all MKV files.
229 (3) Use '.*' to match any character (sort of fuzzy search).
230 (4) Exclude filenames having 'nnn' (compiled with PCRE lib): '^(?!nnn)'
231
232 In the type-to-nav mode directories are opened in filter mode, allowing
233 continuous navigation.
234 When there's a unique match and it's a directory, nnn auto selects the
235 directory and enters it in this mode. Use the relevant program option to
236 disable this behaviour.
237
239 nnn allows file selection across directories and contexts!
240
241 There are 3 groups of keybinds to add files to selection:
242
243 (1) hovered file selection toggle
244 - deselects if '+' is visible before the entry, else adds to selec‐
245 tion
246 (2) add a range of files to selection
247 - repeat the range key on the same entry twice to clear selection
248 completely
249 (3) add all files in the current directory to selection
250
251 A selection can be edited, copied, moved, removed, archived or linked.
252
253 Absolute paths of the selected files are copied to .selection file in the
254 config directory. The selection file is shared between multiple program
255 instances. The most recent instance writing to the file overwrites the
256 entries from earlier writes. If you have 2 instances if nnn open in 2
257 panes of a terminal multiplexer, you can select in one pane and use the
258 selection (e.g. to copy or move) in the other pane (if the instance
259 doesn't have any local selection already).
260
261 nnn clears the selection after file removal, batch-rename and link cre‐
262 ation with selection. However, it is retained after archive creation with
263 selection as the user may want to delete the archived files next.
264
265 To edit the selection use the _edit selection_ key. Use this key to
266 remove a file from selection after you navigate away from its directory.
267 Editing doesn't end the selection mode. You can add more files to the
268 selection and edit the list again. If no file is selected in the current
269 session, this option attempts to list the selection file.
270
272 There are two ways to search and list:
273
274 - feed a list of file paths as input
275 - search using a plugin (e.g. finder) and list the results
276
277 File paths must be NUL-separated ('\0'). Paths and can be relative to the
278 current directory or absolute. Invalid paths in the input are ignored.
279 Input limit is 65,536 paths or 256 MiB of data.
280
281 To list the input stream, start nnn by writing to its standard input.
282 E.g., to list files in current directory larger than 1M:
283
284 find -maxdepth 1 -size +1M -print0 | nnn
285
286 or redirect a list from a file:
287
288 nnn < files.txt
289
290 Handy bash/zsh shell function to list files by mime-type in current
291 directory:
292
293 # to show video files, run: list video
294
295 list ()
296 {
297 find . -maxdepth 1 | file -if- | grep "$1" | awk -F: '{printf "%s ", $1}' | nnn
298 }
299
300 A temporary directory will be created containing symlinks to the given
301 paths. Any action performed on these symlinks will be performed only on
302 their targets, after which they might become invalid.
303
304 Right arrow or 'l' on a symlink in the listing dir takes to the target
305 file. Press '-' to return to the listing dir. Press 'Enter' to open the
306 symlink.
307
308 Listing input stream can be scripted. It can be extended to pick (option
309 -p) selected entries from the listed results.
310
312 The minimum file size unit is byte (B). The rest are K, M, G, T, P, E, Z,
313 Y (powers of 1024), same as the default units in ls.
314
316 The SHELL, VISUAL (else EDITOR) and PAGER environment variables are used.
317 A single combination of arguments is supported for SHELL and PAGER.
318
319 NNN_OPTS: binary options to nnn
320
321 export NNN_OPTS="cEnrx"
322
323 NNN_OPENER: specify a custom file opener.
324
325 export NNN_OPENER=nuke
326
327 NOTE: 'nuke' is a file opener available in the plugin repository.
328
329 NNN_BMS: bookmark string as key_char:location pairs separated by ;:
330
331 export NNN_BMS='d:~/Documents;u:/home/user/Cam Uploads;D:~/Downloads/'
332
333 NNN_PLUG: directly executable plugins as key_char:plugin pairs separated
334 by ;:
335
336 export NNN_PLUG='f:finder;o:fzopen;p:mocplay;d:diffs;t:nmount;v:imgview'
337
338 NOTES:
339 1. To run a plugin directly, press ; followed by the key.
340 2. Alternatively, combine with Alt (i.e. Alt+key).
341 3. To skip directory refresh after running a plugin, prefix with -.
342
343 export NNN_PLUG='m:-mediainf'
344
345 To assign keys to arbitrary non-background non-shell-interpreted cli
346 commands and invoke like plugins, add _ (underscore) before the
347 command.
348
349 export NNN_PLUG='x:_chmod +x $nnn;g:_git log;s:_smplayer $nnn'
350
351 To pick and run an unassigned plugin, press Enter at the plugin prompt.
352 To run a plugin at startup, use the option `-P` followed by the plugin key.
353
354 NOTES:
355 1. Use single quotes for $NNN_PLUG so $nnn is not interpreted
356 2. $nnn should be the last argument (IF used)
357 3. (Again) add _ before the command
358 4. To disable directory refresh after running a command as plugin,
359 prefix with -_
360 5. To skip user confirmation after command execution, suffix with *
361 Note: Do not use * with programs those run and exit e.g. cat
362
363 export NNN_PLUG='y:-_sync*'
364
365 6. To run a GUI app as plugin, add a | after _
366
367 export NNN_PLUG='m:-_|mousepad $nnn'
368
369 EXAMPLES:
370 ----------------------------------- + -------------------------------------------------
371 Key:Command | Description
372 ----------------------------------- + -------------------------------------------------
373 g:-_git diff | Show git diff
374 k:-_fuser -kiv $nnn* | Interactively kill process(es) using hovered file
375 l:-_git log | Show git log
376 n:-_vi /home/user/Dropbox/dir/note* | Take quick notes in a synced file/dir of notes
377 p:-_less -iR $nnn* | Page through hovered file in less
378 s:-_|smplayer -minigui $nnn | Play hovered media file, even unfinished download
379 x:_chmod +x $nnn | Make the hovered file executable
380 y:-_sync* | Flush cached writes
381 ----------------------------------- + -------------------------------------------------
382
383 NNN_COLORS: string of color numbers for each context, e.g.:
384
385 # 8 color numbers:
386 # 0-black, 1-red, 2-green, 3-yellow, 4-blue (default), 5-magenta, 6-cyan, 7-white
387 export NNN_COLORS='1234'
388
389 # xterm 256 color numbers (converted to hex, 2 symbols per context):
390 # see https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg
391 export NNN_COLORS='#0a1b2c3d'
392
393 # both (256 followed by 8 as fallback, separated by ';')
394 export NNN_COLORS='#0a1b2c3d;1234'
395
396 NOTE: If only 256 colors are specified and the terminal doesn't support, default is used.
397
398 NNN_FCOLORS: specify file-type specific colors:
399
400 export NNN_FCOLORS='c1e2272e006033f7c6d6abc4'
401
402 Specify file-specific colors with decimal xterm 256 color numbers converted
403 to 2 hex symbols per color.
404 Order is strict, use 00 to omit/use default terminal color. Defaults:
405
406 ------------------------- + --- + -------------
407 Order | Hex | Color
408 ------------------------- + --- + -------------
409 Block device | c1 | DarkSeaGreen1
410 Char device | e2 | Yellow1
411 Directory | 27 | DeepSkyBlue1
412 Executable | 2e | Green1
413 Regular | 00 | Normal
414 Hard link | 60 | Plum4
415 Symbolic link | 33 | Cyan1
416 Missing OR file details | f7 | Grey62
417 Orphaned symbolic link | c6 | DeepPink1
418 FIFO | d6 | Orange1
419 Socket | ab | MediumOrchid1
420 Unknown OR 0B regular/exe | c4 | Red1
421 ------------------------- + --- + -------------
422
423 If the terminal supports xterm 256 colors or more, file-specific colors will be rendered.
424 To force the earlier colorscheme use option -C.
425 If xterm 256 colors aren't supported, earlier colorscheme will be used.
426
427 NNN_ARCHIVE: archive extensions to be handled silently (default: bzip2,
428 (g)zip, tar).
429
430 export NNN_ARCHIVE="\\.(7z|bz2|gz|tar|tgz|zip)$"
431
432 NOTE: Non-default formats may require a third-party utility.
433
434 NNN_SSHFS: specify custom sshfs command with options:
435
436 export NNN_SSHFS='sshfs -o reconnect,idmap=user,cache_timeout=3600'
437
438 NOTE: The options must be comma-separated without any space between them.
439
440 NNN_RCLONE: pass additional options to rclone command:
441
442 export NNN_RCLONE='rclone mount --read-only --no-checksum'
443
444 NOTE: The options must be preceded by "rclone" and max 5 flags are supported.
445
446 NNN_TRASH: trash (instead of rm -rf) files to desktop Trash.
447
448 export NNN_TRASH=n
449 # n=1: trash-cli, n=2: gio trash
450
451 NNN_SEL: absolute path to custom selection file.
452
453 NNN_FIFO: path of a named pipe to write the hovered file path:
454
455 export NNN_FIFO='/tmp/nnn.fifo'
456
457 NOTES:
458 1. Overridden by a temporary path with -a option.
459 2. If the FIFO file doesn't exist it will be created,
460 but not removed (unless it is generated by -a option).
461
462 https://github.com/jarun/nnn/wiki/Live-previews
463
464 NNN_LOCKER: terminal locker program.
465
466 export NNN_LOCKER='bmon -p wlp1s0'
467 export NNN_LOCKER='cmatrix'
468
469 NNN_MCLICK: key emulated by a middle mouse click.
470
471 export NNN_MCLICK='^R'
472
473 NOTE: Only the first character is considered if not a Ctrl+key combo.
474
475 nnn: this is a special variable.
476
477 Set to the hovered file name before starting the command prompt or spawning a shell.
478
479 NO_COLOR: disable ANSI color output (overridden by NNN_COLORS).
480
482 nnn may not handle keypresses correctly when used with tmux (see issue
483 #104 for more details). Set TERM=xterm-256color to address it.
484
486 Arun Prakash Jana <engineerarun@gmail.com>,
487 Lazaros Koromilas <lostd@2f30.org>,
488 Dimitris Papastamos <sin@2f30.org>.
489
491 https://github.com/jarun/nnn
492
493BSD Nov 17, 2020 BSD