ranger
Vim-inspired TUI file manager with preview.
Official WebsiteFeatures
Installation
brew install rangerapt install rangerpacman -S rangerpip install ranger-fmWhy 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
# Homebrew (macOS)
brew install ranger
# APT (Debian/Ubuntu)
sudo apt install ranger
# Pacman (Arch Linux)
sudo pacman -S ranger
# pip
pip install ranger-fmScreen 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
| Key | Action |
|---|---|
h | Go to parent directory |
j | Move down |
k | Move up |
l | Enter directory / Open file |
gg | Go to start |
G | Go to end |
/ | Search |
q | Quit |
zh | Toggle hidden files |
File Operations
| Operation | Key | Description |
|---|---|---|
| Copy | yy | Copy selected file (yank) |
| Cut | dd | Cut selected file |
| Paste | pp | Paste copied/cut file |
| Delete | dD | Delete selected file |
| Rename | cw | Rename file |
| Select | Space | Select/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 compatibilitykitty- Kitty terminal onlyiterm2- iTerm2 only
# ~/.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 kittyConfiguration & Customization
To generate initial config files, run ranger --copy-config=all.
# ~/.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 truerifle.conf (File Opener Configuration)
Configure applications for opening different file types.
# ~/.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.