Ranger is a CLI filemanager written in Python. Personally I use this program as my only file manager except for conventional Linux CLI. The program starts quickly and can be run over SSH.
It's available in Pypi and can be installed with
pip install ranger-fm
After installing the program, start it in the current directory by running
It follows the VIM-style of shortcuts with
These keys are used for navigation in the file system.
Quit the program with
Keep in mind that ranger distinguishes between capital key presses and non-capital ones.
To quickly open a file / directory in ranger press
f and type the name of the file until it's opened.
When you've typed out enough of the filename / directory to select it, it'll open.
While in the find mode, press
<tab> to select between matching files / directories.
Then you can press
<enter> to open the selected entry.
Will create a new tab in the current directory.
When you switch to a new tab, it'll be created.
If you have many tabs open, the key
q will be used to close the current tab.
Similar to vims line-copy and line-paste.
Select a file for copy with
yy and copy it to the selected directory with
For cut / move operations use
To to an actual remove operation run
<space>to select a file.
v inverts current selection (If no files are selected, the inverse selects all files).
V executes a kind of visual mode like in Vim.
Navigate up and down to select multiple files.
V again to turn it off.
Deselect everything with
Copy / Cut / Paste works with multiple files selected. Most operations work on multiple files.
o for a variety of ways to order the files.
Unlike vim, ranger is more useful when it comes to commands which are based on multiple keys. After pressing the first key of a command sequence, ranger will show a pop-up dialog with all available continuing keys.
dc to collect the total size of a directory.
Follow this up with a
os to order by file / directory sizes.
Like vim, run commands by pressing
:bulkrename opens up an external text editor for renaming all selected files.
Then after editing the file and closing the editor, ranger performs a rename operation based on what you put into the external editor.
There are a few ways to run shell commands in ranger.
The easiest is to press
It just provides a prompt for running a shell command.
When the command is done, ranger pops back up again.
To see what is printed on
stderr from the program run the command by pressing
After the command is done the output is display in
Commands have access to macros which contain information about the current file selection:
The tab-wise scope of the macros can be selected with a number specified. Read the included manual for more about that.
zf to input a filter.
Files that does not have the filter string in the name, will be hidden from view.
To remove the filter again, specify a empty string as filter.
There are default shortcuts to common file system paths.
g to get the list of predefined shortcuts.
You can add your own bookmarks, they'll be in their own list.
Go to a directory and press
m, now press a key.
This shortcut can now be accessed by pressing
' and the assigned key.
This is similar to how vim does bookmarks.
You can select files on a global scope across the file system.
To mark a file with a tag press either
t to mark it with the default tag (
*) or press
" followed by a custom key.
Unlike the selection previously mentioned, tags are not limited to the active working directory.
What's the point of tags?
You can ranger with the argument
x is the tag you want to focus on.
This command prints the path of all files selected with the specified tag.
It's useful for piping into other commands. For example:
ranger --list-tagged="*" | xargs tar cfz my_files.tar.gz
This command copies all tagged file into a compressed tar ball.
FYI: the tags are stored in the file
This only works if the terminal emulator you are using can display bitmap graphics.
Follow the guide in the ranger wiki.
Normally you enter or select a directory to see the content of it.
To get an expanded view of the content of all sub directories in the current working directory.
Use the command
1 means one level of sub directories.
Put any number of sub directories you want to expand.
-1 expand all levels.