Another terminal file manager: lf
Date: 2022-07-21
I haven't written anything Linux or tech related for a while, and I wanted to dive in the lf file manager a little bit more.
For the past few years, my main file manager was ranger. Unlike the mainstream file managers, this one is a terminal based one, made with python and default uses columns for views in a way that you can see the actual directory, the current directory, and its content. Ranger is not the only terminal based file manager out there. When I was little and made first contact with a computer, Norton Commander was probably the most popular file manager for MS-DOS.
About a year ago I saw many videos about lf, a file manager that is definitely faster than ranger. My only problem was that I liked ranger. I was very comfortable with it. I learned all the shortcuts I need, customized it to my liking.
What you have to know about lf, is that it's one binary file, and you need to customize every aspect of it, if you want a working file manager. No delete option, or making directory. Perfect for people, who wants to tinker and build their system from the ground up. On the other hand it takes time to do that, but once you have done that, it's good to use.
Download and install lf
What I did was I went the website, and downloaded the latest release, and put it into my ~/.local/bin directory.
Note that I am running Slackware 15.0 and the kitty terminal.
You can also use your package manager, if you are using a more mainstream distribution.
Customizing lf
The main config file is ~/.config/lf/lfrc.
What I advise to everyone is to search on youtube or github for config files. Look at other's and then see what you need from them. Lazy option I know.
Here are some resources:
- Tutorial on github - screencasting lots of basic stuff, which helps you start using lf.
- Image previews (note that for some reason Überzug didn't work for me - unlike in ranger - but I managed to make it work with kitty previews)
How to Set Up and Configure LF (The Best Terminal File Manager)
This video shows a lot of stuff. If you are just starting with lf, definitely check this out! Not to mention Eric Murphy has some other nice Linux videos!
Keybindings
You can move with the j/k, h/l - up and down and between levels of directories. Or just you can use the arrow keys as well.
Shortcuts are easy to modify with the lfrc file. What's good is that you can assign different keys to the same function. For example I use F2 for renaming from the NC days (and in ranger), while in lf, a simple r is for rename. For a while I kept pressing F2 and of course I got the error message about it. So I just bind the function to it. Or if you are an Emacs user, like me, you can add your usual keys for moving.
Examples:
map <f-2> rename
map <c-n> down
map <c-p> up
I am not a vim user, so I had watch some videos to see certain shortcuts, like for sorting, which you can find with s, and you can reverse it with zr.
You can jump between of your bookmarked directories with g and use the keys you bookmarked.
It's very worth mentioning that shortcuts are case sensitive, so you can map gg and gG or Gg to different functions.
Likes
- It's so fast, that if you blink you'll miss it. Configuration file is just a
simple text file, and documentation is quite good.
- Also nice that it's totally cross-platform, so you can use it basically
everywhere (yes, including BSD).
- Installation is just one binary, very easy to do.
Dislikes
- Why is there no tabs? It would have been nice to be included (like in ranger), but it is uses a client/server stuff, so you can use terminal multiplexers or start up many instances and you can freely copy/cut/paste between them. It will take some time for me to get used to, but since kitty has some tab functionality, I will try to use that.
- Default colors are very shit though, or maybe my kitty terminal went to shit (but I don't have a problem with ranger though).
After a few days…
I will stick to lf for a few more weeks, just to see if it can be my primary file manager.
—
This is post #18 of the #100DaysToOffload challenge, where we write 100 posts in a year. If you are interested in this event, check out the official website: 100DaysToOffload.com. Happy writing everybody! :)