No doubt, Linux is one of the best operating systems, bundled with awesome and beautiful desktop environments like GNOME, KDE, XFCE, etc.
This desktop environment comes with its own file manager, like GNOME gives us Nautilius, KDE gives us Dolphin, and XFCE gives us Thunar, etc.
Also Read: Many users don’t know that CommandLine can do Web-Search too
As a curious Linux user, you may wonder, is it possible to have a file manager experience within the Linux Terminal app? Then my answer will be Ranger.
Table of Contents
What is Ranger on Linux?
Ranger is a terminal (or console) based file manager that uses Vim bindings (for navigation) to give you a file manager experience.
The gem of this file manager is the Rifle (ranger’s file opener) program that will automatically determine the popular file types like TXT, PDF, JPG, PNG, PY, DOCX, EPUB, etc., and run them with the correct programs.
On the other hand, you will find it minimalistic and the experience is seamless, which will allow you to stick with the terminal for a long time.
You can use arrow keys to navigate within the file manager as well as use a mouse to smoothly navigate between different directories or browse the file system.
- Automatically detect file types (.txt, .pdf, .jpeg, .png, .py, .docx, etc)
- Support basic operations like copy, move, delete, create, etc
- UTF-8 Support
- Navigation keys for VIM are used for faster navigation
- Preview the selected file or directory
- Edit multiple files
- Change the directory of your shell after exiting ranger
- Support tabs, bookmarks, mouse support
- Preview files like images, videos, and documents
How do I Install Ranger File Manager?
All Linux distributions ship the Ranger File Manager in their repository by default. However, you can also install it through the Python Package Manager (PyPi).
From default distribution repositories
$ sudo apt install ranger #Work on Debian, Ubuntu, Linux Mint, Pop!_OS, etc $ sudo dnf install ranger #Work on RHEL, Fedora, AlmaLinux, CentOS, etc $ sudo pacman -Sy ranger #Work on Arch, Manjaro, EndeavourOS, etc $ sudo emerge -U app-misc/ranger #Work on Gentoo $ sudo xbps-install ranger #Work on Void Linux
From Python Package Manager
Alternatively, you can install it via the PIP command as shown below.
$ sudo pip install ranger-fm
How to Open Ranger Console File Manager in Linux?
After the installation is successfully completed, launch your terminal or use the existing one and execute the following command to open the Ranger Console File Manager.
Below is the output of the above command.
As you can see above, it is taking the help of the ls command to list the hierarchy of file structures and the cd command to navigate between different directories.
Below you can also find information related to permission and ownership of the selected file/directory, current date and time, file size, and free space.
How to Configure the Ranger Console File Manager in Linux?
There are two configuration paths for Ranger Console File Manager: local and system-wide. Local configuration can be found in the
~/.config/ranger directory, and system-wide configuration is located at
For now, you don’t have to worry about system-wide configuration, you can probably do all the configuration within the local configuration path.
Now, execute the below command to generate the local configs for Ranger Console File Manager.
$ ranger --copy-config=all
This will generate the four main configuration files.
rifle.py: Determine the correct program to be used to launch the files
command.py: Defines ranger console command
rc.conf: Ranger keybindings and settings
scope.sh: Defines how to handle file previews
How do I Use Linux Ranger?
You can use arrow keys or VIM keybindings such as h, j, k, and l to navigate within the Ranger Console File Manager.
Note: If you prefer to have your own custom keybindings instead of VIM, then modify the
rc.confconfiguration file located at
Press Enter to open a file or q to quit. The third column shows a preview of the current file. The second is the main column and the first shows the parent directory.
Below are the common keybindings (cheat sheet) for Ranger Console File Manager.
- k: move up
- j: move down
- h: returns to the parent directory
- l: enters the selected directory or opens a file
- i: Preview the selected file in fullscreen
- q: To close the active tab
- r: Open file
- yy: Copy file
- pp: Paste file
- dd: Cut file
- dd: Delete the file
- g: for navigation and tabs
- o: Sort based on the file name, modified date, size, type, random, reverse
- zh: View hidden file/directory
- cw: Rename file/directory
- z: Update settings
Previewing Files using Ranger
Ranger can automatically detect the known file formats (TXT, PDF, JPG, PNG, PY, DOCX, EPUB, etc.) and open them using the correct program.
Note: By default, Ranger will open graphic files in a new window instead of the parent window. However, you can directly launch xterm and use ranger within it to open graphic files in the same terminal window.
For the opening, GUI-based files like images and video previews require one of the following:
Terminology packages installed on your system.
By default, Ranger uses
w3m-img to open the image files, which are preinstalled on major Linux distributions. However, you can change it with any one of the five mentioned packages.
Open Text File in Ranger
You can easily navigate to text or document files with extensions (.txt, .py, .odt, .docx, .epub, .pdf) in the Ranger Console File Manager. It will automatically show you a preview of the file in text format, as shown below.
Open Image File in Ranger
Ranger supports multiple image formats open by
Terminology packages. To enable the image preview, open the
~/.config/ranger/rc.conf file after generating the configuration file and set
Open PDF File in Ranger
Ranger will automatically detect the PDF file and show you the preview in text format, as shown below.
However, you can change the text preview into a graphic preview showing the image elements. For that, open the
~/.config/ranger/scope.sh file and uncomment the following lines by removing the ‘#‘ in front of them.
After the changes, open Ranger File Manager again and you will find that the PDF file is being opened graphically, as shown below.
You can perform tasks related to file operations by pressing :, followed by:
- bulkrename: Rename in bulk
- openwith: Open the selected file with the program of your choice
- touch FILENAME: Create a new file
- mkdir FILENAME: Create a new directory
- shell <command>: To run a command in the shell
- delete: Delete files with ranger
You can get help by pressing ?, followed by:
- m: Open the manual page
- k: View the list of keybindings
- c: Open the list of commands with their descriptions
- s: View the current settings with their values
I think that’s enough for now. If you have any questions or suggestions for any tools, do let us know in the comments section.
Innovative tech mind with 12 years of experience working as a computer programmer, web developer, and security researcher. Capable of working with a variety of technology and software solutions, and managing databases.