Zachary W. Huang
May 22, 2025
I started using nnn, or n, as a terminal file manager a while ago in the hopes that it would make it just a little easier to navigate folders and do basic file operations in the terminal. I’ve found it quite useful, though I don’t quite think I’ve unlocked its full power yet.
One of the things that it supports is dropping into a nested shell by pressing !
in a directory.
But this means that you could then open nnn
again in the subshell, nesting instances of nnn
.
The cool thing is that when you exit the shell, nnn
will take you back to where you originally opened the subshell from.
Thus, you can repeatedly open nnn
, navigate to a directory, open a subshell, navigate to a different directory and run some commands, and then exit the shell back to where you were before.
It’s almost like leaving breadcrumbs so you never get lost going from directory to directory.
The program also automatically sets an environment variable (NNNLVL
) so you know how many levels of nesting you are at currently.
I added a small bit to my Starship config for zsh so I can see my levels of nnn
nesting in my command prompt.
[env_var.NNNLVL]
format = "(on [floor $env_value ](yellow))"
Now, I can always see which “floor” I’m on in my shell, which I think is really funny.
neofetch
on floor 5 (and no, I will not restart my laptop)