One of the most consequential commands on Linux systems is the standard rm utility. When executed, rm immediately unlinks inodes and deallocates filesystem blocks without routing data through a recycling bin or providing an undo mechanism. A single typographical slip, such as an errant space in rm -rf / tmp/*, can cause catastrophic data loss. To introduce safety and peace of mind to command-line file management, the open-source Rust community developed rip (also known as rm-improved).
What Is rip and Why Is It Superior to Traditional rm?
Unlike standard rm which deletes files irreversibly, rip operates with safety by default:
- Graveyard Staging: Instead of immediate block deallocation, deleted files are moved to a secure graveyard directory (typically inside
/tmp/graveyard-$USERor a designated home folder directory). - Effortless Undeletion: Recovering an accidentally removed file requires a single flag:
rip -u. - Collision-Proof Archiving: If you delete two files sharing identical names at different times,
ripappends precise timestamps, preventing older deletions from being overwritten. - Recursive Directory Handling:
ripremoves directory trees naturally without requiring dangerous-rfflags that bypass confirmation safeguards.
Installing rip (rm-improved) on Linux
You can compile rip using Cargo or download pre-built release binaries across your preferred distribution.
Method 1: Installing via Cargo
If you have Rust and Cargo configured on your machine, compile and install rip directly from crates.io:
cargo install rm-improved
Ensure that your local Cargo binary folder (~/.cargo/bin) is present in your shell’s $PATH environment variable.
Method 2: Installing on Arch Linux
Arch Linux users can install rm-improved directly from the official community repositories:
sudo pacman -S rm-improved
Method 3: Installing Pre-Compiled Release Binaries
For Debian, Ubuntu, Fedora, or enterprise servers without Rust installed, download the binary release from GitHub:
curl -s https://api.github.com/repos/nivekuil/rip/releases/latest \
| grep "browser_download_url.*linux-musl.tar.gz" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -
tar -xzf rip-*-linux-musl.tar.gz
sudo mv rip /usr/local/bin/
Everyday Usage and Essential rip Commands
Using rip mirrors the simplicity of rm while eliminating its catastrophic hazards.
1. Deleting Files and Folders Safely
To send a file to the graveyard, pass its filename:
rip project_notes.txt
To delete an entire directory and its contents, you do not need -r or -f flags:
rip old_build/
2. Inspecting the Graveyard (The Séanced View)
To review everything currently staged in the graveyard along with deletion timestamps and original source paths, use the -s (séance) flag:
rip -s
3. Restoring and Undeleting Files
If you realise a critical script or configuration file was removed by mistake, run the unbury command:
rip -u
An interactive terminal prompt will display recently deleted items. Select the target file, and rip restores it instantaneously to its original directory.
4. Permanently Purging Deletions (Decompose)
When you are certain that files in the graveyard are no longer needed and you want to reclaim physical storage space, purge them permanently:
rip --decompose
Configuring Custom Graveyard Storage Locations
By default, rip places deleted files inside /tmp/graveyard-$USER. Because /tmp is frequently a memory-backed tmpfs or wiped during system reboot, you can redirect the graveyard to a persistent home directory partition:
- Open your shell profile (e.g.,
~/.bashrcor~/.zshrc). - Define the
$GRAVEYARDenvironment variable:
export GRAVEYARD="$HOME/.local/share/graveyard"
- Create the target directory:
mkdir -p ~/.local/share/graveyard
Aliasing rm to rip Safely
To guard against habit-based muscle memory, you can alias standard rm calls in your shell configuration:
alias rm="rip"
Now, whenever you or an interactive script invokes rm, the files will be routed safely into the graveyard, preventing irreversible data destruction.