Terminal GuideTerminal Guide
ranger icon

ranger

File Managers
macOSLinux
Python

Vim-inspired TUI file manager with preview.

Official Website

Features

Vim KeybindingsPreviewBookmarksTabsPlugin Support

Installation

Homebrew
brew install ranger
APT (Debian/Ubuntu)
apt install ranger
Pacman (Arch)
pacman -S ranger
pip
pip install ranger-fm

Why use ranger?

Vim-like Navigation

Navigate with hjkl keys intuitively for Vim users. Low learning curve enables efficient file operations.

Three-Pane Layout

Three-pane structure with parent, current, and preview directories. Manage files while keeping directory structure visible at a glance.

Rich Preview Support

Preview text, images, PDFs, archives and more within the terminal. Supports image display with w3m or ueberzug.

Highly Extensible

Written in Python, easy to extend with plugins and custom commands. Customize applications in rifle.conf for opening files.

Installation

Installation Commands
# Homebrew (macOS)
brew install ranger

# APT (Debian/Ubuntu)
sudo apt install ranger

# Pacman (Arch Linux)
sudo pacman -S ranger

# pip
pip install ranger-fm

Screen Layout

ranger uses the Miller columns (three-pane) layout. From left to right: parent directory, current directory, and preview/subdirectory.

┌─ ranger: ~/projects ─────────────────────────────────────────┐
│                                                              │
│  ..                   README.md          # Terminal Guide    │
│  .git/                package.json       Project description │
│  node_modules/        tsconfig.json      and setup steps     │
│  public/              next.config.js     ...                 │
│ >src/                                                        │
│  .eslintrc.json                          ## Installation     │
│  .gitignore                              npm install         │
│  .prettierrc                             npm run dev         │
│                                                              │
│ Parent dir           Current dir        Preview              │
│                                                              │
└──────────────────────────────────────────────────────────────┘
│ src/ (5 items) | 1.2MB free | 1/8 | ranger 1.9.3            │
└──────────────────────────────────────────────────────────────┘

Basic Operations

KeyAction
hGo to parent directory
jMove down
kMove up
lEnter directory / Open file
ggGo to start
GGo to end
/Search
qQuit
zhToggle hidden files

File Operations

OperationKeyDescription
CopyyyCopy selected file (yank)
CutddCut selected file
PasteppPaste copied/cut file
DeletedDDelete selected file
RenamecwRename file
SelectSpaceSelect/deselect file
New Directory:mkdir Create new directory
New File:touch Create new file

Preview Functionality

ranger supports preview for various file types. Image preview requires additional tools.

Supported File Types

  • Text files (with syntax highlighting)
  • Image files (w3m / ueberzug / kitty)
  • PDF (pdftotext)
  • Archives (zip, tar, etc.)
  • HTML (w3m / lynx)
  • Markdown

Image Preview Settings

  • ueberzug - Highest quality (X11)
  • w3m - Lightweight, wide compatibility
  • kitty - Kitty terminal only
  • iterm2 - iTerm2 only
~/.config/ranger/rc.conf
# ~/.config/ranger/scope.sh (Preview settings)
# Image preview requires w3m or ueberzug

# Preview settings with ueberzug
set preview_images_method ueberzug

# Preview settings with w3m (alternative)
# set preview_images_method w3m

# For kitty terminal
# set preview_images_method kitty

Configuration & Customization

To generate initial config files, run ranger --copy-config=all.

~/.config/ranger/rc.conf
# ~/.config/ranger/rc.conf

# Enable 3-pane layout
set viewmode miller

# Enable preview
set preview_files true
set preview_directories true
set preview_images true

# Vim-like keybindings
set mouse_enabled false

# Show hidden files
set show_hidden true

# Display file information
set display_size_in_main_column true
set display_size_in_status_bar true

# Color scheme
set colorscheme default

# Enable tabs
set dirname_in_tabs true

rifle.conf (File Opener Configuration)

Configure applications for opening different file types.

~/.config/ranger/rifle.conf
# ~/.config/ranger/rifle.conf
# Application settings for opening files

# Text files
mime ^text, label editor = ${VISUAL:-$EDITOR} -- "$@"
mime ^text, label pager  = $PAGER -- "$@"

# Image files
mime ^image, has feh, X, flag f = feh -- "$@"
mime ^image, has sxiv, X, flag f = sxiv -- "$@"

# PDF
ext pdf, has zathura, X, flag f = zathura -- "$@"
ext pdf, has evince, X, flag f = evince -- "$@"

# Videos
mime ^video, has mpv, X, flag f = mpv -- "$@"
mime ^video, has vlc, X, flag f = vlc -- "$@"

Tips

Bookmark Feature

Bookmark current directory with m + any key, and jump to it with ' + key.

Tab Feature

Open new tabs with Alt + number or gnto work with multiple directories in parallel.

Shell Integration

Press S to launch a shell in the current directory. Ranger will be restored when you exit.

Bulk Rename

Use :bulkrename to rename multiple files at once with an editor. Efficiently change multiple file names.

Written by Dai AokiPublished: 2026-01-20

Related Articles

Explore More