How to Install and Use rip in Linux as a Safe and Fast Alternative to rm

Every Linux administrator and command-line enthusiast is familiar with the perilous nature of the standard rm command. Running rm -rf on an unintended directory path results in immediate, unrecoverable data loss because traditional UNIX file systems immediately unlink inode records. While shell aliases mapping rm to rm -i offer interactive confirmation, they quickly cause prompt fatigue. rip (often distributed as rm-rip) is a modern, blazing-fast file deletion tool written in Rust that provides a safe alternative by routing deleted files to a temporary graveyard directory with instant restoration support.

What Is rip and How Does It Prevent Data Loss?

Unlike rm which unlinks file data permanently, rip operates with safety and transparency at its core:

  • Graveyard Directory Routing: When you delete a file or directory with rip, it moves the target to a designated graveyard location (typically /tmp/graveyard-$USER or ~/.local/share/Trash), keeping your primary workspace clean without destroying data.
  • Collision Avoidance: If you delete multiple files with identical names (such as successive versions of build.log), rip appends precise millisecond timestamps to prevent overwriting previous deletions.
  • Effortless Undo Functionality: Accidentally deleted a file? Running rip -u lists recently discarded items and restores them to their original directory paths instantaneously.
  • Automatic File System Boundary Awareness: Automatically checks partition boundaries to perform atomic renames across the same disk, falling back to safe copying when spanning filesystems.

Step 1: Installing rip on Linux

rip is available via package managers, pre-compiled binaries, and Cargo.

Option A: Install via Native Repositories

On Arch Linux and its derivatives:

sudo pacman -S rm-rip

On Alpine Linux (Testing repository):

sudo apk add rip

Option B: Install via Pre-Compiled GitHub Release

For Debian, Ubuntu, Fedora, openSUSE, and enterprise Linux systems, download the official binary directly from GitHub:

# Download latest binary release
curl -LO https://github.com/MilesCranmer/rip/releases/latest/download/rip-linux-x86_64.tar.gz

# Extract archive
tar -xzf rip-linux-x86_64.tar.gz

# Move binary to executable path
chmod +x rip
sudo mv rip /usr/local/bin/

Option C: Install via Rust Cargo

If you maintain a local Rust development environment:

cargo install rm-rip

Verify that the tool executes properly by checking its version:

rip --version

Step 2: Deleting Files and Directories Safely

Using rip mirrors the syntax of standard file manipulation commands:

Deleting Single and Multiple Files

# Remove a single document
rip report.docx

# Remove multiple files simultaneously
rip image1.png image2.png data.csv

Deleting Entire Directories Recursively

Unlike rm which demands the recursive flag -r, rip deletes directories natively without requiring extra arguments:

rip old-project-backup/

Step 3: Restoring Accidentally Deleted Files

If you mistakenly delete a critical script or configuration file, recover it within seconds using the interactive undo mode:

rip -u

rip displays a numbered list of recently deleted items alongside their original timestamps and paths:

0: /home/user/workspace/app.py (deleted 2 minutes ago)
1: /home/user/workspace/config.yaml (deleted 10 minutes ago)
2: /home/user/workspace/dist/ (deleted 1 hour ago)
Select an item to restore (or press q to cancel): 0

Type the number corresponding to the item you wish to recover and press Enter. rip instantly moves the item back to its original location.

Step 4: Inspecting and Emptying the Graveyard

To view all items currently staged in your safe deletion graveyard without initiating an interactive restore:

# Inspect graveyard contents
rip -s

Permanently Purging the Graveyard

When you are certain that deleted items are no longer required and wish to reclaim disk space, purge the graveyard:

# Empty entire graveyard permanently
rip --seppuku

Step 5: Safely Aliasing rip in Your Shell

To protect your daily shell workflow against inadvertent typing habits, configure a shell alias:

Open your ~/.bashrc or ~/.zshrc file:

nano ~/.bashrc

Add the following alias definitions:

# Replace default rm with rip
alias rm="rip"

# Retain access to native GNU rm when needed
alias real-rm="/bin/rm"

Reload your shell configuration:

source ~/.bashrc

Verifying Command-Line Safety Workflows

Test your setup by creating a dummy test file with touch test_file.txt and deleting it via rm test_file.txt. Running rip -u will verify that the file was safely intercepted and can be restored in a single keystroke. Replacing destructive removal with an intelligent graveyard layer provides permanent peace of mind across all your terminal operations.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.