Motivation
The terminal is the most-used tool for my daily work. Sometimes, I just want to navigate files and folders directly within the terminal. Therefore, a Terminal File Manager (TFM) is a necessary consideration to improve my productivity and streamline my tasks. On Windows, I use tere for this purpose. After shifting to macOS, I am looking for an alternative to tere.
Popular TFMs for macOS
There are several terminal file managers are recommended for macOS:
Ranger
- Ranger is a versatile file manager with Vim-like keybindings
- Written in Perl, very old
- Customizable through Python scripts
nnn
- nnn is a fast and lightweight file manager
- Tiny and requires nearly 0-config
Lf
- Lf stands for “List files”
- Written in Go, lightweight
Yazi
- Yazi is a newer option written in Rust
- Leveraging non-blocking async I/O
- Modern and intuitive interface
- Good documentation
Getting started
To install these tools on macOS, you can use package managers like Homebrew.
After installation, simply type the name of the file manager in your terminal to launch it.
Some of the other useful shortcuts for nnn are:
Shortcut | Utility |
---|---|
. | toggle hidden files |
d | toggle detail mode (show size, permissions and timestamps) |
q | quit |
/ | filter (press / and start typing to filter the contents of the current directory. It is very useful and quick. Press / twice, it changes to \ and type a regular expression for filtering) |
‘ | first file match (press ' and then a character to go to the first file/diectory starting with that character) |
^n | toggle type-to-navigate (type to filter and navigate, rather than commands) |
B | bookmark the current directory (b to list all bookmarked directories) |
~ | takes you home (pressing ~ again takes you back). ` takes you to root, - back and @ start. |
^T | toggle sort order (d enables the du (disk usage) mode where you can see the size of directories) |
] | command prompt (^] for shell) |
? | get help on all the keyboard shortcuts and configuration |
Configure cd on quit
Ranger
If you hit Shift + S
, it opens a new shell on the current directory. Then if you hit Ctrl + D
on the shell, it goes back to ranger
. This workaround is often good enough.
nnn
To set this up, place the following code in ~/.zshrc
file. This creates a new alias n
for launching nnn
. When launched with the new alias n
, your terminal directory will be changed on quitting nnn
.
You can find more details here.
Yazi
Use the following yy
shell wrapper that provides the ability to change the current working directory when exiting Yazi.
To use it, copy the function into the configuration file of your respective shell. Then use yy
instead of yazi
to start.
You can fine more details here.