RTFM - Ruby Terminal File Manager

April 11, 2026 · View on GitHub

Ruby Gem Version Unlicense Documentation Stay Amazing

A feature-rich terminal file manager written in pure Ruby. Browse directories with syntax-highlighted previews, inline images, remote SSH/SFTP access, comprehensive undo system, OpenAI integration, and much more.

RTFM parses your LS_COLORS for consistent terminal theming and runs on any modern terminal emulator.


Quick Start

# Install
gem install rtfm-filemanager

# Run
rtfm

# Or start in specific directory
rtfm ~/Documents

# Use as file picker (tag files with t, quit with q)
rtfm --pick=/tmp/selected_files.txt

# Press ? for help

After first run, use r command to launch RTFM and exit into your current directory.


Screenshots

OpenAI File AnalysisInteractive AI Chat
AI analyzing a PDFAI chat mode
Syntax HighlightingSystem Information
Ruby code highlightingSystem stats (press S)

Table of Contents


Key Features

File Operations

  • Comprehensive undo system - Undo delete, move, rename, copy, symlink, permissions, ownership
  • Trash bin - Optional safe deletion with restore capability
  • Bulk operations - Copy, move, delete multiple tagged items
  • Bulk rename - Pattern-based renaming (regex, templates, case conversion)
  • Permission management - Change permissions with undo support (755, rwxr-xr-x, +x, -w)
  • Ownership management - Change user:group with undo support

Display & Preview

  • Syntax highlighting - File content with bat/batcat
  • Inline images - w3m and Sixel protocols via termpix gem
  • EXIF orientation - Correct display of rotated images
  • Video thumbnails - ffmpegthumbnailer integration
  • Archive preview - View contents of .zip, .tar, .gz, .rar, .7z files
  • Document preview - PDF, LibreOffice, MS Office files
  • LS_COLORS parsing - Consistent terminal color theming

Remote Operations

  • SSH/SFTP browsing - Navigate remote directories seamlessly
  • Interactive SSH shell - Drop into shell sessions on remote hosts
  • File transfer - Download and upload files
  • Connection caching - Smart caching for performance

Advanced Features

  • Git integration - Status display for repositories
  • Cryptographic hashing - Directory tree verification
  • OpenAI integration - File descriptions and interactive chat
  • Tab management - Multiple tabs with duplication and renaming
  • File picker mode - Use RTFM as a file selector for other applications (--pick)
  • Fuzzy search - fzf integration
  • Navi integration - Interactive command cheatsheets

Developer Features

  • Plugin system - Live enable/disable plugins with built-in manager (V key)
  • Example plugins - Settings editor, git, bookmarks, notes, custom openers
  • Ruby debug mode - Execute arbitrary Ruby in context
  • Command history - Preserved across sessions

Installation

gem install rtfm-filemanager

Full Installation with All Features

Ubuntu/Debian:

sudo apt update
sudo apt install ruby-full x11-utils xdotool bat pandoc poppler-utils \
  odt2txt docx2txt unzip gnumeric catdoc w3m imagemagick \
  ffmpegthumbnailer tar gzip bzip2 xz-utils unrar p7zip-full

gem install rtfm-filemanager

ArchLinux/derivatives

sudo pacman -Syu ruby bat pandoc poppler odt2txt docx2txt unzip gnumeric catdoc w3m imagemagick ffmpegthumbnailer p7zip libreoffice-fresh
gem install rtfm-filemanager

Note: catppt is not available in official repos, but RTFM will fall back to using LibreOffice's soffice for .ppt files. For xls2csv, use an AUR helper:

yay -Syu perl-xls2csv

macOS:

brew install ruby imagemagick w3m bat pandoc poppler

gem install rtfm-filemanager

Dependencies

Required:

  • Ruby 2.7+
  • rcurses gem (~> 6.0)
  • termpix gem (~> 0.2)

Optional (for full functionality):

  • ImageMagick - Image preview (identify, convert)
  • w3m-img - w3m image protocol
  • xdotool - Image redraw on workspace switching
  • bat/batcat - Syntax highlighting
  • fzf - Fuzzy file finding
  • pandoc - Document conversion
  • ffmpegthumbnailer - Video thumbnails
  • ruby-openai - AI integration

Keyboard Reference

For complete reference: man rtfm or press ? in RTFM

Essential Keys

KeyAction
?Show help
qQuit (save config)
QQuit (don't save)
rRefresh display
VPlugin manager
KeyAction
j / Move down
k / Move up
h / Parent directory
l / / ENTEREnter directory / open file
HOME / ENDFirst / last item
PgUp / PgDnPage up / down

Marks & Jumping

KeyAction
m + letterSet bookmark
' + letterJump to bookmark
~Jump to home
>Follow symlink
Ctrl-rRecent files/directories
Ctrl-eToggle remote SSH mode

Tagging

KeyAction
tTag/untag item
Ctrl-tTag by pattern
TShow tagged items
uUntag all

File Operations

KeyAction
pCopy tagged items here
PMove tagged items here
sCreate symlinks
cRename item
EBulk rename (patterns)
dDelete (→ trash if enabled)
DTrash browser (browse, restore, delete)
Ctrl-dToggle trash on/off
UUndo last operation

Permissions

KeyAction
Ctrl-pChange permissions (with undo)
Ctrl-oChange ownership (with undo)

Permission formats: 755, rwxr-xr-x, rwx, +x, -w, +rw

Search & Filter

KeyAction
fFilter by extension
FFilter by regex
/Search and highlight
n / NNext / previous match
gGrep content
LLocate files
Ctrl-lFuzzy find (fzf)

Display

KeyAction
-Toggle preview on/off
_Toggle image preview
bToggle syntax highlighting
wChange pane width
BCycle borders
aShow/hide hidden files
AToggle long info (ls -l)
oChange sort order
iInvert sort

Clipboard

KeyAction
yCopy path (primary selection)
YCopy path (clipboard)
Ctrl-yCopy image/text to clipboard

Git / AI / System

KeyAction
GGit status
HDirectory hash
IOpenAI file description
Ctrl-aOpenAI chat
SSystem information
XCompare two files
eFile properties

Tabs

KeyAction
]New tab
[Close tab
J / KPrevious / next tab
}Duplicate tab
{Rename tab
1-9Switch to tab #

Command Mode

KeyAction
:Execute shell command
;Command history
@Ruby debug mode
§Force interactive mode (prefix)
+Whitelist program as interactive

Interactive mode example: :§htop - runs htop in full terminal


Remote SSH/SFTP Browsing

Access and manage files on remote servers directly from RTFM.

Activating Remote Mode

  1. Press Ctrl-e
  2. Enter connection string:
    user@server.com:/path/to/directory
    

Connection Formats

# Basic SSH
user@server.com:/path

# Custom SSH key
-i ~/.ssh/custom-key user@server.com:/path

# SSH URI
ssh://user@server.com/path

# With comment
user@server.com:/path # Production server

Remote Mode Keys

KeyAction
/ hParent directory
/ ENTEREnter dir / show file info
DDownload file
uUpload tagged files
sOpen SSH shell
Ctrl-eExit remote mode

Visual indicator: Red background when in remote mode

Archive Browsing

Press Enter on any archive file (.zip, .tar.gz, .tar.bz2, .tar.xz, .rar, .7z) to browse its contents as a virtual directory.

KeyAction
dDelete entry from archive
DExtract entry to origin directory
pAdd pre-tagged local files into archive
tTag/untag for bulk operations
LEFTParent directory / exit archive

Visual indicator: Yellow-green background when in archive mode


Configuration

Configuration stored in ~/.rtfm/conf

Quick Config

ActionCommand
View configPress C (or interactive editor with Settings plugin)
Save configPress W
Reload configPress R

Tip: Install the Settings plugin for an interactive settings editor with live color preview. See Plugins.

Common Settings

# ~/.rtfm/conf

# Enable trash bin
@trash = true

# Toggle preview on/off
@preview = true

# Show/hide images
@showimage = true

# Show hidden files
@lsall = "-a"

# Show long file info
@lslong = true

# Pane width (2-7)
@width = 5

# Border style (0-3)
@border = 2

# OpenAI API key
@ai = "your-api-key-here"

# Directory bookmarks (persistent)
@marks = {"h" => "/home/user", "d" => "/home/user/Documents"}

# Command history (persistent)
@history = ["git status", "ls -la"]

# Interactive programs whitelist
@interactive = "htop,vim,emacs,nano"

# Top line background colors by path match
@topmatch = [["projects", 165], ["", 238]]

Color Customization

# Bottom pane
@bottomcolor = 238

# Command mode
@cmdcolor = 24

# Ruby mode
@rubycolor = 52

# OpenAI chat
@aicolor = 17

OpenAI Integration

RTFM includes built-in AI features powered by OpenAI's API for intelligent file analysis and interactive assistance.

Setup

  1. Get an API key:

  2. Configure RTFM: Add your API key to ~/.rtfm/conf:

    @ai = "sk-your-actual-api-key-here"
    @aimodel = "gpt-4o-mini"  # Optional: default model
    @aicolor = 17             # Optional: chat pane background color
    

The ruby-openai gem is already included as a dependency when you install RTFM.

Features

File Description (Press I)

Get an intelligent summary of any file or directory:

  • Files: Purpose, code review (for source files), library documentation lookup
  • Directories: Overview of structure and contents
  • Git-aware: Includes recent changes if in a git repository
  • Smart analysis: Automatically includes preview content for context

Example uses:

  • Understand unfamiliar codebases quickly
  • Get code review suggestions (bugs, style, improvements)
  • Learn what libraries/APIs are being used
  • See git diff explanations in plain language

Interactive Chat (Press Ctrl-a)

Start a conversational AI assistant specialized in:

  • File and directory questions
  • Shell command help and suggestions
  • Terminal workflow assistance
  • Programming and scripting guidance

The chat maintains context throughout your RTFM session, so follow-up questions work naturally.

Configuration Options

# Model selection (in ~/.rtfm/conf)
@aimodel = "gpt-4o-mini"      # Fast, cost-effective (default)
@aimodel = "gpt-4o"           # More capable, higher cost
@aimodel = "gpt-4-turbo"      # Alternative high-end model

# Chat interface color
@aicolor = 17                 # Dark blue background (default)

Cost & Privacy

  • API calls cost money (typically $0.001-0.01 per request with gpt-4o-mini)
  • File contents are sent to OpenAI when using I key
  • No data is sent unless you explicitly press I or Ctrl-a
  • Chat history persists only during your RTFM session

Plugins

RTFM has a plugin system with live enable/disable. Plugins live in ~/.rtfm/plugins/ as .rb files and are auto-loaded on startup.

Plugin Manager (V key)

Press V to open the built-in plugin manager:

  • See all available plugins with their status (ON/OFF)
  • Press ENTER to toggle a plugin on or off (takes effect immediately)
  • Press ? to view the plugin's built-in help text
  • No restart required

Example Plugins

RTFM ships with five example plugins in the examples/ directory. Copy any of them to ~/.rtfm/plugins/ to activate:

cp examples/settings.rb ~/.rtfm/plugins/
cp examples/git.rb ~/.rtfm/plugins/
cp examples/bookmarks.rb ~/.rtfm/plugins/
cp examples/notes.rb ~/.rtfm/plugins/
cp examples/opener.rb ~/.rtfm/plugins/
cp examples/diskusage.rb ~/.rtfm/plugins/
cp examples/dupes.rb ~/.rtfm/plugins/
PluginKeyDescription
SettingsCInteractive editor for settings without dedicated keys (colors, trash, interactive programs, OpenAI config). Color changes apply in real-time. Overrides the default config viewer
GitCtrl-GGit operations menu: status, diff, commit+push, log. Output shown in right pane
BookmarksF6Unlimited directory bookmarks with fuzzy filtering. Add, delete, and jump to bookmarked directories. Complements the built-in single-letter marks (m/')
NotesF5Attach text notes to any file or directory. View, edit, or delete notes. Stored in ~/.rtfm/notes/
OpenerRIGHT/lCustom file openers by extension. Configure a hash of extension-to-command mappings (e.g., .hl files open in hyperlist)
Disk UsageSInteractive disk usage analyzer. Extends system info with a browseable size-sorted directory view with visual bars
DupesF7Find duplicate files by content hash. Two-pass scan (size then SHA256) with in-place deletion of duplicates

Writing Your Own Plugins

A plugin is a simple Ruby file with metadata comments and KEYMAP bindings:

# @name: My Plugin
# @description: What it does
# @key: X

KEYMAP['X'] = :my_action

# Optional: register help text shown by ? in plugin manager
PLUGIN_HELP['My Plugin'] = <<~HELP
  This is the help text for my plugin.
  Shown when pressing ? in the plugin manager.
HELP

def my_action
  clear_image
  @pR.update = true
  @pR.say("Hello from my plugin!")
end

Plugins can also be defined in ~/.rtfm/keys.rb for personal bindings that don't need the enable/disable mechanism.

Preview Handlers (preview.rb)

Custom file type previews are configured separately in ~/.rtfm/preview.rb:

# Syntax: ext1, ext2 = command with @s placeholder
txt, log = bat -n --color=always @s
md = pandoc @s -t plain
pdf = pdftotext -f 1 -l 4 @s -
json = jq . @s

Available Variables for Plugin Authors

VariableDescription
@pTTop pane (info bar)
@pLLeft pane (file list)
@pRRight pane (preview)
@pBBottom pane (status)
@pCmdCommand prompt (use .ask(prompt, default) for input)
@selectedCurrently selected file/dir
@taggedArray of tagged items
@external_program_runningSet true when launching TUI programs
PLUGIN_HELPHash to register help text (keyed by plugin name)

Plugin Helper Functions

# Capture command output as string
output = command("ls -la", timeout: 5)

# Run command interactively (full terminal)
shellexec("grep -r pattern .")

# Read a keypress
chr = getchr

# Clear any displayed image
clear_image

# Text formatting
"text".fg(112)   # foreground color (0-255)
"text".bg(236)   # background color
"text".bd        # bold
"text".ul        # underline
"text".rv        # reverse

Image Display

RTFM uses the termpix gem for modern multi-protocol image display.

Supported Protocols

TerminalProtocolStatus
urxvtw3m✓ Perfect
xtermSixel✓ Perfect
mltermSixel✓ Perfect
kittyKitty✓ Perfect
footSixel✓ Perfect

Features

  • EXIF orientation - Phone photos display correctly
  • Auto-detection - Best protocol for your terminal
  • Aspect ratio - Images never stretched
  • Toggle - Press _ to toggle image preview
  • Copy to clipboard - Press Ctrl-y on image

Terminal Compatibility

Best image experience with: kitty, urxvt, xterm, mlterm, foot


RTFM vs Ranger

FeatureRTFMRanger
LanguagePure RubyPython
Size~6K lines (single file)~22K lines (modular)
LicenseUnlicense (public domain)GPL v3
LS_COLORSNative parsingRequires theming
Remote SSH/SFTP✓ Built-in
Undo System✓ ComprehensiveLimited
Trash Bin✓ With restore
OpenAI Integration
Permission/Ownership Undo
Image ProtocolsSixel + w3mVarious (ueberzug, kitty)
Tab Management✓ Enhanced✓ Basic
Bulk Rename✓ Patterns
Plugin SystemRuby-basedPython-based
CommunitySmallLarge (16.6k stars)
DocumentationGrowingExtensive

Philosophy:

  • Ranger: Minimalistic, "do one thing well"
  • RTFM: Feature-packed, "jam packed with features"

Best for:

  • RTFM: Power users wanting SSH workflows, undo, AI integration, maximum features
  • Ranger: Users wanting clean, minimal, well-documented VIM-style navigation

Documentation

Additional Guides


Screenshots

RTFM in action

Keyboard Cheat Sheet:

RTFM keyboard reference


Latest Updates

Version 8.2 Highlights

  • Plugin system with live enable/disable - Plugins in ~/.rtfm/plugins/ are auto-loaded on startup. Toggle them on and off at runtime with the plugin manager (V key), no restart needed. Each plugin can register help text viewable with ?.
  • Seven example plugins - Settings editor, git operations, directory bookmarks, file notes, custom file openers, disk usage analyzer, and duplicate file finder. Copy from examples/ to ~/.rtfm/plugins/ to use.
  • Trash browser (D key) - Browse trash contents with timestamps and original paths. Restore files to their original location, permanently delete individual items, or empty all trash.

Version 8.1 Highlights

  • File picker mode - rtfm --pick=/path/to/output.txt launches RTFM as a file selector. Browse and tag files normally with t, then quit with q. Tagged file paths are written one per line to the output file. Enables integration with email clients, upload tools, and other applications that need a file selection dialog.

Version 7.3 Highlights

  • Modern image display with termpix gem (Sixel + w3m protocols)
  • Performance optimizations for large images
  • UTF-16 file support for opening in $EDITOR
  • Image clipboard copy (Ctrl-y)
  • Persistent selection after operations

Version 7.2 - BREAKING CHANGE

Batch operations now use consistent "tagged OR selected" logic:

  • Tagged items exist → operate ONLY on tagged
  • No tagged items → operate on selected

Migration: Explicitly tag selected item with t if you want it included.

See CHANGELOG.md for complete version history.


How It Works

RTFM is a two-pane file manager with enhanced tab support:

  • Left pane: Directory/file list with navigation
  • Right pane: Preview, info, command output
  • Top bar: Current path and file metadata
  • Bottom bar: Status, prompts, commands
  • Tab indicator: [2/5] shows current tab position

Tab Features:

  • Multiple tabs for multi-directory management
  • Duplicate tabs (}) to copy directory context
  • Rename tabs ({) for organization
  • Quick switch with number keys (1-9)

Enhanced UX:

  • VIM-style navigation (hjkl)
  • Arrow key support
  • Persistent bookmarks and tagged items
  • Command history across sessions
  • Comprehensive undo for safety

First Run

On first launch, RTFM:

  1. Shows welcome message
  2. Adds r function to your shell (~/.bashrc, ~/.zshrc)
  3. Creates ~/.rtfm/ directory
  4. Generates plugin templates

The r function lets you:

  • Launch RTFM with single key
  • Exit into RTFM's current directory (not launch directory)

Workflow:

r              # Launch RTFM
# Navigate to desired directory
q              # Exit RTFM
pwd            # You're in RTFM's last directory!
r              # Back into RTFM

Why RTFM?

Created to solve a specific problem: file managers should parse LS_COLORS natively instead of requiring separate themes.

The Origin Story:

While working on a complete LS_COLORS setup, I realized creating a matching ranger theme was redundant. File managers should respect terminal colors by default.

This became RTFM - a file manager that parses LS_COLORS automatically.

Why Rewrite?

The old curses library was clumsy. So I created rcurses - a modern, pure Ruby curses implementation. From v5 onwards, RTFM runs on rcurses, providing:

  • Better stability
  • Cleaner code
  • More features
  • Active development

Development

For Users

Bug reports and feature requests welcome at: https://github.com/isene/RTFM/issues

For Developers

Ruby Debug Mode: Press @ to enter Ruby REPL mode. Execute arbitrary Ruby code:

# Examples:
puts @selected        # Show current selection
puts @tagged.inspect  # Show tagged items
puts @marks          # Show bookmarks

Plugin Development: See ~/.rtfm/plugins/ directory for templates and examples.

Contributing: This is a personal project built for my needs. Cool feature requests may be included. Code contributions welcome via pull requests.


Author

Geir Isene

License

Unlicense - Public Domain

Permission granted to use, copy, modify, distribute, and sell this software for any purpose without restriction.


See Also

  • rcurses - Pure Ruby curses library
  • termpix - Terminal image display gem
  • ranger - Python-based file manager
  • LS_COLORS - Comprehensive terminal color setup

Stay Amazing