Ranger File Manager: How to setup & use Ranger for Beginners

Ranger is a powerful file manager for Linux machines. In this tutorial we’re going to learn what Ranger is, how to install, setup, configure, and use ranger.

What is Ranger and how does it help me?

Ranger helps you manage and navigate your filesystem quickly. If you want to quickly get from one directory in your system to another, ranger can get you there quickly. If you want to remove files, copy/move, or preview a bunch of images quickly, rename a series of files, or anything to do with your filesystem ranger can help you do things faster.

Ranger is also highly configurable. If you have something in mind, you can probably implement it in ranger. Let’s see it in action.

Step 1. How to Intall Ranger:

Installation instructions are on their Github page: https://github.com/ranger/ranger . I used my Linux distro’s package manager to install the program with:

$ sudo apt install ranger

Step 2. Get config files

I found these instructions on the arch wiki: https://wiki.archlinux.org/index.php/Ranger but for some reason my install didn’t ship with the config files. You can easily get them by running this command:

$ ranger –copy-config=all

Quick Note: by default ranger might not display images in their preview pane. We’ll cover this later in the article. First let’s learn some keybindings.

Step 3. Easy & common ranger keybindings

Before we get into the weeds, let’s get some easy wins. Here’s an incomplete list of commands that are commonly used:

moving: hjkl (vim style) h & l take you in and out of parent/children directories while j & k take you up and down the current directory.

Shift + j or k = up/down half page

f -> Find… hit “f” then type what you’re looking for in that dir.

:flat (num) to flatten directories num of levels. Instead of seeing /Code you’ll see /Code/proj1 /Code/proj2 etc… and be able to use f to search multiple directories at once.

shift+s -> exit back to shell but in the current directory ranger is in… If that doesn’t work check out link below this text block for an alternative.

zh = toggle hidden files showing/hiding

Ctrl + b = up a page
Ctrl + f = down a page

Ctrl + n OR gn = new ranger tab
gc = close tab
Tab = move to next tab
Shift+Tab OR gT = previous Tab

r = open file in chosen program. (can configure this. too lazy to look though sorry. lol)

gh = go to home dir
gm = go to /media

space = mark file/dir
v = mark all
uv = unmark

:delete = delete selected files/dirs (press y after)

yy = copy
ya = add to copy (probably easy to change that)
yr = remove files from current copy

dd = cut
da = add to current cut operation
dr = remove from current cut operation

pp = paste

cw = rename a file/dir

q = quit back into shell in directory you launched ranger from

s = launch shell from inside ranger

:touch = make file
:mkdir = make directory

1? (and then k to select view keybindings) shows all default keybindings

How to exit ranger shell into current dir if Shift+s doesn’t work: https://superuser.com/questions/1043806/how-to-exit-the-ranger-file-explorer-back-to-command-prompt-but-keep-the-current

Another way to see your keybindings is to check out around line 305 and below in your .config/ranger/rc.conf file

To get your hidden files showing in Ranger, change your rc.conf file’s “set show_hidden” to true

Setup Ranger’s image previews in compatible terminals

Unfortunately there’s limited compatibility with image previews in terminals. If yours isn’t on the list you should still give it a try, but no promises.

Step 1: Start with compatible terminal

In the rc.conf file you can see iterm2, terminology, urxvt, urxvt-full, and kitty as compatible with image previews in Ranger. So I recommend using one of those first to see things are working smoothly. I chose to use Terminology.

Step 2: setup the image previewing in rc.conf

set “preview_images” to true, and preview_images_method to your choice of terminal in the rc.conf file:

# Use one of the supported image preview protocols
set preview_images true
# further below …
set preview_images_method terminology

I was able to get setup without too much trouble on Terminology.

Step 3. Install w3m (or w3m-ing)

I recommend checking out the docs, but I was able to get image previews working by just installing w3m using my Linux package manager and setting up the rc.conf as above, and using terminology. Here’s two potentially helpful links. Otherwise, just run:

$ sudo apt install w3m

https://github.com/ranger/ranger/wiki/Image-Previews and https://github.com/ranger/ranger/wiki/Official-user-guide

Bulk renaming available

I demonstrate this in the video, but essentially you just mark the files you’d like to rename, and then type…

:bulkrename

Then enter. Then name all the files without screwing up the lines… Then write, and confirm with the editor that you’d like to proceed, and voila! renamed files!

Future Todos: Color Schemes & customizing commands.

I scanned through the documentation, but was too lazy to read through it since I don’t care for customizing color schemes and don’t have any custom commands in mind at the moment. Hopefully this guide was helpful and enough to get you up and running with Ranger. If you’re not satisfied, check out some further reading like setting up video previews, or the custom commands page.

Leave a Comment

Your email address will not be published. Required fields are marked *

want more details?

Fill in your details and we'll be in touch

%d bloggers like this: