A shell guardrail that intercepts dangerous terminal commands from humans and AI coding agents and requires confirmation before running them.
MilesCranmer/rip2
A safer, Rust-based replacement for rm that moves deleted files to a recoverable graveyard instead of erasing them.
- Stars
- 679
- Forks
- 15
- Open issues
- 11
- Last commit
- 18 days ago
What is it?
rip2 is a command-line tool for deleting files and directories. Instead of permanently removing them, it moves deleted items into a graveyard directory, typically under /tmp/graveyard-$USER, keeping their absolute paths so they can be restored. If two deleted items share the same path, the newer one is saved as a numbered backup, so no data is overwritten.
The interface is simple: files and directories are removed without needing -rf, and the -u flag restores the most recent deletion. Other options include -i to inspect a target before burying it, -s to list items deleted from the current directory, and -d to permanently empty the graveyard. The graveyard location can be changed with a flag, the RIP_GRAVEYARD environment variable, or XDG_DATA_HOME.
rip2 is a maintained fork of nivekuil/rip. It supports Linux, macOS and Windows, and can be installed via Homebrew, Cargo, Nix or prebuilt binaries. It does not implement the xdg-trash specification.
Key features
- 01Moves deleted files to a graveyard keyed by absolute path for recovery.
- 02Restores the last deletion or specific files with rip -u.
- 03Renames conflicting deletions as numbered backups instead of overwriting.
- 04Shows size and content preview of targets before deleting with -i.
- 05Lists files deleted from the current directory with -s.
- 06Generates shell completions via clap.
Use cases
- Replacing rm in daily shell work to avoid accidental permanent deletion.
- Recovering files removed by mistake from a scripted or interactive session.
- Cleaning up directories while keeping a recoverable record of what was deleted.
Quick start
- 1
Install with Homebrew
brew install rip2 - 2
Delete files and directories
rip file.txt dir1 dir2 - 3
Undo the last deletion
rip -u
Things to know
- Files are moved to a graveyard in /tmp by default, which may be on a RAM-backed filesystem and fill memory with large deletions.
- It does not implement the xdg-trash spec, so it will not integrate with desktop trash bins.
Topics
FAQ
- What is rip2?
- A safer, Rust-based replacement for rm that moves deleted files to a recoverable graveyard instead of erasing them. rip2 is a command-line tool for deleting files and directories. Instead of permanently removing them, it moves deleted items into a graveyard directory, typically under /tmp/graveyard-$USER, keeping their absolute paths so they can be restored. If two deleted items share the same path, the newer one is saved as a numbered backup, so no data is overwritten.
- Is rip2 free to use? What license does it have?
- rip2 is open source under the GPL-3.0 license. Check the license terms before using it in commercial products.
- Is rip2 still maintained?
- Actively maintained. The last commit to rip2 was on Oct 4, 2026.
- What can I use rip2 for?
- Replacing rm in daily shell work to avoid accidental permanent deletion. Recovering files removed by mistake from a scripted or interactive session. Cleaning up directories while keeping a recoverable record of what was deleted.
- How do I install rip2?
- Install with Homebrew: brew install rip2 Delete files and directories: rip file.txt dir1 dir2 Undo the last deletion: rip -u
- Where can I get rip2?
- The source code and installation instructions are on GitHub: https://github.com/MilesCranmer/rip2
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A line-oriented regex search tool (rg) that recursively searches directories while respecting .gitignore rules by default.
A cat(1) clone for the terminal with syntax highlighting, Git change markers, and automatic paging.
A fast, user-friendly command-line alternative to the Unix find command for locating files and directories by name.
A smarter cd command that learns your most-used directories and lets you jump to them with a few keystrokes, across all major shells.
A command-line tool for benchmarking commands with statistical analysis, warmup runs, and exports to CSV, JSON, Markdown and AsciiDoc.