10 ms·
Show HN: Nnn – unorthodox terminal file manager
- vorpalhex 6y agoThis is very exciting and planning to give it a try to see if it can finally replace my usage of midnight commander. I appreciate the clean aesthetics. Please don't hide your feature list under a toggle though! Put it all the way at the top - I nearly missed it.
- apjana 6y agoThank you for the appreciation! The full feature list is not hidden, it's below because it got way too long (who would have thought?). The toggled one is a quick peek into some of the cool things users can do with nnn.
- jonfw 6y agoI never understood terminal file managers... If I want to find a file, I use find or fzf. If I want to list files in a directory, I can use tree or ls. If I want to move files around, cp and mv work great. If I want something more rich or discoverable, I'll just move to a GUI, which handles this much better.
- apjana 6y agoTry to think of it as an endless ls-cd loop with tons of automated functionality few keypresses away. Also, please try the type-to-nav mode in nnn. Also, find/fzf etc. are useful as long as you are not on a slow disk and a mid-range Android device/the Pi. If you are saying you are OK with scanning the whole filesystem every time you are looking for something that can be anywhere under /, I simply don't prefer that.
- Scarbutt 6y agoIf you are saying you are OK with scanning the whole filesystem every time you are looking for something that can be anywhere under / You can specify a target directory from which to start the search.
- apjana 6y agoBookmarks you mean. Yes, in nnn you can jump to the bookmark from anywhere and then press `Alt-O` (my preferred key) to start the search. But you know what, let me share a smarter workflow: find . -iname "*.mp3" -print0 | nnn -p - Now you list all yours mp3 files in nnn, examine/play them and finally get to cherry-pick some and print them to stdout when you quit nnn. BTW, you can also run the find within nnn and list in nnn.
- joshuak 6y agoI see what you did there
- mst 6y agoIf you're looking for something that can be anywhere under /, then the target directory needs to be /.
- apjana 6y agoYes, that's what I intended to convey.
- mekster 6y ago> endless cd-ls loop Better to have "chpwd() { ls }" in your .zshrc as this executes ls after cd'ing to save up on your infinite amount of ls typing.
- apjana 6y agoThat'll print the list of files even in a populated directory like /usr/bin and leave me at the prompt with the last few files listed above. As soon as you want the list of files not to go away so you can control/manage/examine them, you are talking of a file manager.
- mekster 6y agoWho would regularly cd into /usr/bin/? If you only work inside messy folders with hundreds of files all the time, maybe it's time to tidy up.
- necrotic_comp 6y agoExactly. I don't understand what these grant me in terms of flexibility and workflow that bash + shell scripts do ? Can someone who uses these tools explain ?
- apjana 6y agoIf your scripts do all of the following, you are already using a file manager: https://github.com/jarun/nnn#features https://github.com/jarun/nnn#features
- necrotic_comp 6y agoThat doesn't really help - something like "POSIX-compliant, follows Linux kernel coding style" doesn't really indicate what it's useful for. My question isn't snark. It's more like "what is the usecase and what advantages does it have over standard terminal workflows?" FWIW: My main file manipulations I need to do are within vim when working on a project. I typically use nerdtree for this, but having a project that's consistent in my environment would be good. I do other manipulations using standard tools like ls/rm/etc. what advantages does this have over those ?
- int_19h 6y agoIf you have to cd/ls around a lot, it's simply faster once you get used to it.
- greenshackle2 6y agoI use them because they fit better in my workflow. I use a tiling WM and vim bindings everywhere I can because keyboards hurt my hands less than mice. I use them just for discovery, if I know what I want mv / cp / find are better. tree doesn't work so well if you have a sub-directory with hundreds of object files, etc.
- apjana 6y agoYes, cd, ls, mv, cp etc. don't help much in unknown territory.
- stevekemp 6y agoThey can be handy if you're in the middle of something else, and you need one without distraction. I don't personally use them, but I live in emacs for many hours a day so I do use its integrated directory-manager (dired) to perform simple operations.
- apjana 6y ago> They can be handy if you're in the middle of something else, and you need one without distraction. Add a drop-down temrminal file manager to the mix, so you never lose your context. ;)
- qmmmur 6y agoThanks for voicing what I've been feeling. I've just never got any kind of file browser in the terminal. As you said, there are better tools for browsing that require less investment in a partiuclar way of thinking.
- sophacles 6y agoWhy do I want to invest in the particular way of thinking required to use GUI file browsers when I have a plethora of options in the terminal? (ranger, lf, mc, and nnn being the better know ones, but there are others too)
- vngzs 6y agoI like using terminal file managers for quickly traversing many nested directories, where I'm not sure where I want to go. I can use it to browse around and hjkl is familiar as a vim user. With ranger[0], I can even use it as an alternative to cd, which is often the most convenient (I usually want a terminal in the last directory I browsed to, not the place where I opened the file manager[1]). I hope to find a way to use nnn similarly, but it (like ranger) doesn't seem to support this out of the box. [0]: https://github.com/ranger/ranger https://github.com/ranger/ranger [1]: https://unix.stackexchange.com/questions/342064/ranger-cd-into-a-folder-and-invoke-shell https://unix.stackexchange.com/questions/342064/ranger-cd-in...
- apjana 6y ago> With ranger, I can even use it as an alternative to cd cd on quit works in nnn as well... and many other file managers.
- vngzs 6y agoThanks for pointing this out - here's the link, for anyone interested: https://github.com/jarun/nnn/wiki/Basic-use-cases#configure-cd-on-quit https://github.com/jarun/nnn/wiki/Basic-use-cases#configure-...
- apjana 6y ago> but it (like ranger) doesn't seem to support this out of the box No utility can support cd-on-quit out of the box because a spawned process can't send the $PWD to the parent directly when it quits. It needs tweaks in your shell's rc file. nnn also needs the same instrumentation.
- bradly 6y agoFind has a pretty poor API in my opinion. Replacing it with fd is a simply improvement similar to ripgrep over grep. Separately, I have a bunch of keybindings to load sets of files into fzf for easy access. Things like modified files, files changed in current branch, branches modified in the past six weeks. All of these have make working for a large code base much easier for me with little downside except have to piece them together on a new machine.
- mssundaram 6y ago> Separately, I have a bunch of keybindings to load sets of files into fzf for easy access. Do you have your dotfiles available to share? That sounds really useful
- bradly 6y agoI don't have dotfiles online, but many were inspired by this gist: https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236 https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f... For other things like files changed in current branch I've just kludged together aliases: branch_files='git log --decorate --pretty=oneline --abbrev-commit --name-only --no-merges --first-parent main..HEAD | fpp' (fpp extracts file paths from output) If you use zsh it can also helpful to setup suffix aliases so just the filename is bound to an application. For instance `alias -s {rb,erb,rake,css,js}=vim`
- apjana 6y agoThanks for sharing!
- apjana 6y agoI found switching to fd challenging. fd makes some of the options easy. But find and fd are not syntactically the same. I guess I didn't spend enough time with it.
- bradly 6y ago
- progman32 6y agoSometimes a GUI is faster for me, especially when I'm not 100% sure where things are or there are many files to select. A terminal file manager has a GUI that works everywhere, including over SSH sessions (OK, technically could use X forwarding, but it's slow).
- apjana 6y ago> Sometimes a GUI is faster for me, especially when I'm not 100% sure where things are or there are many files to select. nnn takes care of these already. I don't think you would see a difference once you get used to.
- bch 6y agoIn my life I’ve occasionally used emacs dired-mode[0] to do medium-sized file operations; more than just 1 or 2 files, but not worth building a script w heuristics. [0] https://www.emacswiki.org/emacs/DiredMode https://www.emacswiki.org/emacs/DiredMode
- apjana 6y agoThe problem with emacs-based solutions is the speed.
- bch 6y agoHasn’t been a problem for me for years. It seems to me that often this argument is based (directly or indirectly) from conditions 20 or more years ago. I think Emacs itself hasn’t changed much (it’s gotten better, but not fundamentally different), but the supporting environments (read: hardware) easily make for a usable experience. There are better poster children for bloat these days.
- apjana 6y agoCan't counter that given I've last used emacs years back.
- bigbubba 6y agoI suppose I've not tried it in any sort of extreme scenario, but it's not clear to me what dired would be slow at. Functions like copy-file are implemented in C.
- apjana 6y agoMy response was from from emacs perspective. Here's a memory usage comparison: https://github.com/jhallen/joes-sandbox/tree/master/editor-perf#memory-used-when-loading-helloc-with-syntax-highlighting-enabled https://github.com/jhallen/joes-sandbox/tree/master/editor-p... Looks like emacs uses at least double the memory.
- warp 6y agoMy main use nowadays is to select files. i.e. I have a folder with many files, and I need to cp or mv some of them elsewhere. If it's more than a handful tab completing them is a chore, so I run "mc". A gui doesn't help, because usually I'm on a remote server somewhere (using SSH).
- apjana 6y agoI think that workflow is available in almost any terminal file manager now.
- anonzzz 6y agoTake a look at Ranger. Ranger gives you the ability to do things like bulk edit files within a vim editor. Try doing this on the cli with the same efficiency and speed. This is where a term file manager really begins to shine...
- apjana 6y agonnn has an in-built batch-renamer as well as a more powerful POSIX-compliant plugin to do that. List of features: https://github.com/jarun/nnn#features https://github.com/jarun/nnn#features
- zepto 6y agoFewer keystrokes.
- Avshalom 6y agoI can't speak to any of the others but Midnight Commander is the best and best maintained of the two-panel (orthodox) file managers.
- 1996 6y agoTry ranger, even less orthodox, to get a MacOS like navigation into your directories from left to right (aka Miller columns), but with VI key bindings and lots of extra features: https://en.wikipedia.org/wiki/Ranger_(file_manager) https://en.wikipedia.org/wiki/Ranger_(file_manager) https://wiki.archlinux.org/index.php/Ranger https://wiki.archlinux.org/index.php/Ranger
- apjana 6y ago> lots of extra features https://github.com/jarun/nnn#features https://github.com/jarun/nnn#features
- prox 6y agoThis looks great! Looking forward to testing this. When I get my Raspberry Pi 400 :)
- apjana 6y agoYou'll enjoy it for sure!
- tarruda 6y ago> No FPU usage (all integer maths, even for file size) I wonder what is the significance of avoiding floating point math in a program that will spend most of its time waiting for user input.
- apjana 6y agoYou are looking for the benchmarks: https://github.com/jarun/nnn/pull/84 https://github.com/jarun/nnn/pull/84
- otabdeveloper4 6y agoDon't know what the situation is like today, but not so long ago not all architectures supported floating point numbers. Math operations were emulated in software libraries, which was slow and buggy.
- apjana 6y agoI get the sarcasm but probably a lot of that would depend on the calculation involved.
- davibu 6y agoNow I want to see the unorthodox git manager.
- apjana 6y agoThere are so many of them! GitHub, for example. ;)
- lmohseni 6y agoHave you ever played with Magit? It’s an emacs front end for git that is utterly amazing. Works great with evil-mode if you prefer vim bindings.
- O_H_E 6y agoNot really unorthodox, but I have been really liking SublimeMerge on linux. I know MacOS is Win have a few nice GUI clients but non support linux. https://www.sublimemerge.com/ https://www.sublimemerge.com/
- chris_st 6y agoGitKraken [1] has Linux .deb, .tar.gz, .rpm, and snap downloads. Free for basic use. [1] https://www.gitkraken.com/download https://www.gitkraken.com/download
- taejavu 6y agohttps://github.com/chriswalz/bit https://github.com/chriswalz/bit
- 29athrowaway 6y agoI tried nnn after I was dissatisfied with ranger's startup time. nnn is much faster, but I was already used to ranger's keystrokes and I did not want to learn a new set of keystrokes. Then learned about lf, a ranger clone written in go, which is much faster. That is what I use now. It is possible that nnn is the fastest file manager out there. You may also want to try Midnight commander, a timeless classic.
- minimalist 6y agoA note for anyone who is thinking of switching from ranger, to customize key bindings you need to recompile the application [0]. The developer is not interested in maintaining custom keybinding support. For more insight into the reasoning behind the current keybindings see this issue thread [1]. Also mentioned in this thread, lf a ranger clone written in go [2]. [0]: https://github.com/jarun/nnn/wiki/Advanced-use-cases#custom-keybinds https://github.com/jarun/nnn/wiki/Advanced-use-cases#custom-... [1]: https://github.com/jarun/nnn/issues/422 https://github.com/jarun/nnn/issues/422 [2]: https://github.com/gokcehan/lf https://github.com/gokcehan/lf
- apjana 6y agoYes, that's the stand from the beginning and there are good reasons behind that. If you read the issue thread, we did spend a good amount of time discussing those keybinds and most users find them reasonable. Speaking of compiling, the only mandatory library dependency is ncurses and the users don't consider it a significant problem. For example, Arch Linux users install most software from source using formulas and so do Homebrew users. So the tools to build are already present on the system. nnn also has an option to make the process simpler. Additional details - https://github.com/jarun/nnn/wiki/Advanced-use-cases#custom-keybinds https://github.com/jarun/nnn/wiki/Advanced-use-cases#custom-...
- oehtXRwMkIs 6y agoThe funny thing about nnn is that the maintainer is absurdly responsive to the point that whenever I didn't like something, rather than configuring it, I would complain and after some consensus from fellow complainers it would get changed in a commit which I immediately enjoyed since I use nnn-git from the AUR. I feel like I configure nnn via github issues xD
- apjana 6y agoThat's correct, we don't tend to add dispensable features without multiple users asking for it. Of course, features you demand would mean the world to you, but from where I stand, a feature bloat is the last thing in my mind. And the funny thing is, some users find it reasonable.
- unnouinceput 6y agoNNN is a very poor choice of words as is a slang for something else, especially this month. Maybe change it to N3.
- apjana 6y agoPlease read the first sentence in the project readme.
- hyiltiz 6y agoI am having difficulty locating which is the first sentence you were referring to in the README.md, and what it has to do with the (what) slang. nnn - Supercharge your productivity! Latest release Availability Travis Status CircleCI Status Privacy Awareness License icons and colors asciicast [Features] [Quickstart] [Plugins] [Documentation] nnn (n³) is a full-featured terminal file manager.
- apjana 6y agon³ The unorthodox terminal file manager. ;)
- unnouinceput 6y agoAh, so you're definitely aware of the slang. Well, in that case what can I say except "good luck with the adoption".
- apjana 6y agoNot until I posted my hard work in one of these public forums for people to use and benefit.
- dfdz 6y agoI just tried using nnn and found it to work reasonable well. However, I could not figure out how to change the default editor to open vim in the same terminal. Then I realized that I can accomplish this task already by running vim . It seems almost identical to nnn with the restriction that everything is opened vim.
- apjana 6y agoCheck out the config var `NNN_OPENER` and program option `-e`.
- smusamashah 6y agoIt reminds of broot https://github.com/Canop/broot/ https://github.com/Canop/broot/
- deleted 6y ago[deleted]
- mekster 6y agoNot sure but vifm never shows up in these type of posts but I find it a good alternative. https://github.com/vifm/vifm https://github.com/vifm/vifm
- apjana 6y agoYes, that's a good file manager too! Especially for people familiar with vim.
- O_H_E 6y ago@apjana since I have you here. (Feel free to gracefully decline to answer any of the following.) May I ask why are you not trying to leverage the assortment of useful tools you wrote with sizeable following to be some kind of side income? I didn't miss the paypal link on every repo, but I don't think that would make much without being a recurring payment and a little bit of blog posting. This was partly inspired by the 'to spend more time with his kid than at a computer' quote. a bit off topic: do you have a rough idea about the number of actual users, other than github stars? I am not trying to doxx you or anything :D, just thinking about the dynamics of open source and my own inspirations. ----- Disclaimer: I don't any experience with what I am talking about.
- apjana 6y ago> May I ask why are you not trying to leverage the assortment of useful tools you wrote with sizeable following to be some kind of side income? I started contributing to open source because I learn a lot from it since my graduation days. I think of it as a payback to the community. Having said that - I do appreciate users donating now and then. :) > This was partly inspired by the 'to spend more time with his kid than at a computer' quote. My regular job is a demanding one. So I have to work smart to save time for my kid and family. Some of the utilities were written to help with that. > Do you have a rough idea about the number of actual users, other than github stars? Not really. But I know for sure even some orgs use some of my utilities.