What is Vifm (Vi File Manager)?
Vifm is a ncurses library based file manager for Linux which allows you to perform almost every file related task (like viewing, moving, deleting etc) right from the shell. It has no GUI, so each task needs to be performed using the keyboard. This might seem odd to some people, but it is beneficial in a way. And, if you are familiar with vi/vim, you will love this file manager as most of the keybindings are vi- like.
Why should you use it?
Here’s a good reason for that. Speed. It is all good to use a GUI file manager, but when you need things quick, without taking away your hands from the keyboard, you will need a good text based file manager. There are other text-based file manager too (like midnight commander), but I like Vifm more as you don’t have learn a new set of key bindings for it (if you are familiar with vi).
In this tutorial, I’m going to tell you how to perform some very basic tasks using Vifm. Although, these commands are not even a handful compared to the operations that Vifm supports, but these will help you get started with Vifm (and also improve your command on the keyboard).
Download and Installation:
Vifm is available in the official repositories of the popular Linux distributions. In Arch, it is available as vifm, and you can install it by:
sudo pacman -S vifm
Same goes for Ubuntu and other distribution, just type the command you usually type for installing some software and replace the software name with vifm. Alternatively, you can get the source code from official Vifm website, and build it locally on your computer.
When you are done installing, you can start it by typing vifm in your favorite terminal emulator. When Vifm starts, it presents you with two panes, each displaying a directory tree. The following is a list of some handy commands for some handy operations.
Recommended for you: How to Enable Hidden Offline Browsing In Google Chrome
Some basic file operations with Vifm:
- Switching between panes:
Just press space bar and you will switch to the next pane. An asterisk mark will set on the file/directory of the pane you just left. When you press the space key again, you will reach that particular file/directory.
- Basic movement between files:
When you switch to a pane, you will notice a blue highlight on a file.
- The ‘j’ and ‘k’ key will move the cursor one line down and up respectively.
- The ‘h’ key will move cursor up one directory (i.e move to previous directory).
- The ‘l’ key will move cursor inside the directory selected or it can open files too if cursor is on that.
- ‘gg’ and ‘G’ key will move cursor to the top and bottom of the file list respectively.
Most commands work the same way as they do in vi. Like pressing a number proceeded by ‘G’ moves you to that file in list etc.
- Copying a file
Go to the file you want to copy in one of the pane. Press ‘yy’. Go to the destination either by switching the pane and moving to desired file or simply moving in the present pane. When you reach destination (i.e inside the folder where you want to copy the file), press ‘p’.
It is better to open the source and destination directory in separate panes when you want to perform multiple copy operations as it is quicker. Press ‘v’ to highlight the files you want to copy. Press ‘y’ after highlighting. Switch to other pane by pressing space. Press ‘p’ there.
- Deleting a file
Just go to file you want to delete. Press ‘dd’ (press ‘d’ key twice) and you are done. Or, you can delete multiple files at once. Press ‘v’, highlight the files you want to delete using ‘j’ or ‘k’, and press ‘dd’ after that.
- Renaming a file
Move the cursor to the file. Press ‘cw’ (first ‘c’ then ‘w’) and type the new name. Alternatively, press ‘cW’ if you want to maintain the extension.
- Moving a file
Moving is just deleting a file and pasting it somewhere else. To do this, press ‘dd’ on the file you want to move, switch to destination, and press ‘p’ there.
- Searching for a file
Go to the directory where the file is. Press ‘/’ key, type the search keyword and press enter.
- Quitting vifm
Press ‘:q’ and vifm will quit.
It would take some before your hands get familiar with the key bindings. With practice and repetition, you can perform these tasks like a pro. I suppose these commands would be sufficient to get started with Vifm.If you want more operations, just type ‘man vifm‘ in your terminal. It will present you with more information than you may ever need. Or you can visit Vifm online documentation.
If you need help with a particular command, or want to suggest an edit, just post a comment, I would love to help.