| Crates.io | safe-rip |
| lib.rs | safe-rip |
| version | 1.0.0 |
| created_at | 2025-11-30 15:40:27.256906+00 |
| updated_at | 2025-11-30 15:40:27.256906+00 |
| description | Safe rm alternative — moves files to trash instead of permanent deletion |
| homepage | |
| repository | https://github.com/faridhassani95/rip |
| max_upload_size | |
| id | 1958387 |
| size | 956,655 |
rm
Delete files safely. Restore instantly. Never follow symlinks by mistake.
rip is implemented in Rust for multiple key reasons:
Rust allows us to combine safety, performance, and robustness, solving problems that are tricky in shell scripts or Python-based tools.
Deleting files in Linux seems trivial, but there are multiple edge cases:
Cross-Device Moves: mv fails with EXDEV when moving files between filesystems (like external drives or network mounts).
Symlink Safety: Traditional rm can follow symlinks accidentally, deleting unintended files.
symlink_metadata() to detect symlinks, deletes only the link itself, handles broken links gracefully.Safe Restore: Restoring files can conflict with existing paths.
Persistent Auto-Cleanup: Existing trash utilities rarely support policies like deleting after N days or asking before cleanup.
ask, never, 30d) for automated management.flowchart TD
A[User runs rip <file>] --> B{Is file a symlink?}
B -->|Yes| C[Move symlink itself to Trash]
B -->|No| D{Is file on same filesystem?}
D -->|Yes| E[Move file to Trash directory]
D -->|No| F[Copy file to Trash then delete original]
C --> G[Update metadata and NanoID]
E --> G
F --> G
G --> H[Done]
cargo install rip
git clone https://github.com/faridhassani95/rip.git
cd rip
cargo build --release
sudo cp target/release/rip /usr/local/bin/
echo "alias rm='rip'" >> ~/.bashrc # or ~/.zshrc
source ~/.bashrc
rip file.txt folder/ symlink # Move to trash
rip --list # List trashed items
rip --restore 1 # Restore newest item
rip --empty # Permanently empty trash
rip --keep 30d # Auto-delete items older than 30 days
rip --keep ask # Ask before cleaning old items
rip --keep never # Disable auto-clean
rip --keep # Show current policy
| Feature | rip (Rust) | trash-cli (Python) | gio trash (GNOME) | rm (coreutils) |
|---|---|---|---|---|
| Language | Rust (native) | Python | C++/GLib | C |
| Never follows symlinks | ✅ Yes (symlink_metadata) | ⚠️ Yes (dangerous) | Sometimes | ❌ Always |
| Broken symlink handling | ✅ Graceful (/RIP_BROKEN_LINK) | ⚠️ Warnings / crash | Inconsistent | N/A |
| Cross-filesystem move (EXDEV) | ✅ Auto copy + delete | ❌ Fails | ✅ Yes | N/A |
| Restore when original path exists | ✅ Auto-rename | ⚠️ Overwrites | ❌ Fails | N/A |
| Auto-cleanup policies | ✅ ask • never • 30d | ❌ No | ❌ No | N/A |
| Unique trash filenames (NanoID) | ✅ Yes | ❌ No | ❌ No | N/A |
| Binary size | ~1.5 MB | 15+ MB | System library | <100 KB |
| Install with cargo install rip | ✅ Yes | ❌ No | ❌ No | Pre-installed |
Verdict: rip is the only CLI trash tool combining Rust speed, symlink safety, cross-device support, and persistent auto-cleanup policies.
MIT © Farid
Built with ❤️ and 🦀 — stop deleting, start ripping.