Brief: Explore a terminal-based file browser application that can be used with the Vim style key bindings.
And nothing wrong with it because you’ll get the cd command on any Linux system you log in.
However, if the system is maintained by you and you want to have a better view of the directories, a file manager does a lot better than the cd or tree command.
Yes, you can get file managers in the terminal as well. They may not be as good as the GUI ones like Nautilus but still better than the plain old commands.
There are several TUI file browsers and we have covered a few of them on It’s FOSS. Today, we look at vifm.
What is vifm?
vifm is a command line tool that is a file manager with key bindings for navigation and file system object manipulation that are similar to vim. In case you are wondering what I meant by “file system objects”, they are files, directories, symbolic links, hard links etc.
Along with the very intuitive vim interaction key bindings, below is the set of features that vifm offers you
- A fast file manager right in your terminal
- Edit the text file from the file manager itself
- vifm uses the curses interface
- vifm is cross platform (can even work on Windows with the help of Cygwin; it should work but I have not tested it)
- Supports vim style key binding inputs like dd, j, k, h, l etc
- The vifm plugin is available to be used inside vim for opening file(s) through vim
- Auto complete support for the vim commands
- Support for more than one panes
- Allows batch rename with [or without] regex
Installing vifm on Linux
The vifm package isn’t new and therefore is readily available in even the “stable” distributions’ (like Debian) repositories by default.
On Debian and Debian based distros (like Ubuntu, Pop!_OS, Mint etc), you can use the apt package manager to install vifm:
sudo apt install vifm
sudo pacman -S vifm
vifm is also available in the Fedora and RHEL repositories; install vifm with the DNF package manager:
sudo dnf install vifm
Once you have vifm installed, you can simply type vifm your terminal – like below – and start vifm
The vifm user interface
When you launch vifm for the first time, by default, it will launch with the overview of the directory that you are currently in. You will also notice, that vifm uses two panes by default.
If you find yourself confused at the interface, simply try pressing the j key to move the cursor down one row, and press the k key to move the cursor up one row. You can move up one directory by pressing the h key. Just like vim!
If your cursor is currently on a file, pressing the l key will open the file in vim (if not stated otherwise). But if your cursor is on a directory, pressing the l key will navigate in the directory and show you the directory contents.
You can also get details about a file or directory from the file manager by pressing the Ctrl + g key binding.
You can press the keys “za” to either show files and directories that are hidden (files and directories with a period at beginning are hidden by default). If these special files and directories are not hidden, pressing za will hide them.
You can either permanently show hidden files and directories with the “zo” key binding and never make these items visible with the “zm” key binding.
vifm is an amazing file manager, specially for Vim users because it integrates so well with the Vim ecosystem. It incorporates many vim features and key bindings into a file manager. The default two pane layout makes it more productive.
Do not hesitate to give vifm a try. It really is an amazing command line tool!