Modern rm replacement with trash, undo, and Btrfs support
Project description
rmsafe
A modern rm replacement that moves files to trash instead of deleting them.
Install
# uv (recommended)
uv tool install rmsafe
# pipx
pipx install rmsafe
# Homebrew
brew install leftrk/tap/rmsafe
# pip
pip install rmsafe
Usage
Replace rm in your shell:
alias rm='rmsafe trash'
Commands
| Command | Description |
|---|---|
rmsafe trash <files> |
Move files to trash |
rmsafe restore <pattern> |
Restore trashed files |
rmsafe list [pattern] |
List trashed files |
rmsafe undo [n] |
Undo recent deletions |
rmsafe undo --list |
Show undo history |
rmsafe empty [days] |
Empty trash |
rmsafe status |
Trash statistics |
Examples
rmsafe trash file.txt # Move to trash
rmsafe trash *.log --dry-run # Preview
rmsafe restore file.txt # Restore
rmsafe undo # Undo last deletion
rmsafe undo --list # Show history table
rmsafe empty 7 # Delete files older than 7 days
rmsafe status # Panel with stats
Features
- Rich output: Tables, panels, icons, progress bars
- Undo history: Track and undo recent deletions
- Smart UX: Progress bar for batch operations, transient cleanup
- Cross-platform: macOS (
~/.Trash), Linux (FreeDesktop Trash spec) - Btrfs optimized: Zero-copy reflink clone on Linux
- JSONC config: Comments and trailing commas supported
Config
~/.config/rmsafe/config.jsonc:
{
"trash": { "location": null, "auto_clean_days": 30 },
"behavior": { "confirm_large_files": "10MB", "undo_history_limit": 100 },
"output": { "color": "auto", "icons": true }
}
vs trash-cli
| Feature | rmsafe | trash-cli |
|---|---|---|
| Output | Rich tables/icons | Plain text |
| Undo history | Built-in | Limited |
| Progress bar | Yes (≥4 files) | No |
| Config format | JSONC | INI |
| Btrfs clone | Yes | No |
Development
git clone https://github.com/leftrk/rmsafe.git
cd rmsafe
uv sync
uv run pytest
uv run ruff check .
CI runs on Ubuntu + macOS × Python 3.11–3.13.
License
GPL-2.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rmsafe-1.2.0.tar.gz.
File metadata
- Download URL: rmsafe-1.2.0.tar.gz
- Upload date:
- Size: 126.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6cf907c1d4ad7e25dd7081c225a4344a3d78a94fb7aec93a40992cddd98056a
|
|
| MD5 |
0aa997cd4343fff415e74dbd1fbc2100
|
|
| BLAKE2b-256 |
30941b72630f0dea37ececd2a8a2c8b157ac8381bcaf87a4279e0e86c58295a7
|
Provenance
The following attestation bundles were made for rmsafe-1.2.0.tar.gz:
Publisher:
release.yml on leftrk/rmsafe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rmsafe-1.2.0.tar.gz -
Subject digest:
f6cf907c1d4ad7e25dd7081c225a4344a3d78a94fb7aec93a40992cddd98056a - Sigstore transparency entry: 1389541792
- Sigstore integration time:
-
Permalink:
leftrk/rmsafe@fbf5b34deff37772088e2deab5473fd14fb48504 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/leftrk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fbf5b34deff37772088e2deab5473fd14fb48504 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rmsafe-1.2.0-py3-none-any.whl.
File metadata
- Download URL: rmsafe-1.2.0-py3-none-any.whl
- Upload date:
- Size: 46.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4088db2890e6a4e5a7ecc2f4c4f214c937fb41ddd11a4f0e11665829a4dd7f36
|
|
| MD5 |
7b5b3c6525ebe7e116e88b87e6d8646f
|
|
| BLAKE2b-256 |
60969a3905c5b2cddf80458f1186cda31b741e0325174cfc0fadc798cbb51d32
|
Provenance
The following attestation bundles were made for rmsafe-1.2.0-py3-none-any.whl:
Publisher:
release.yml on leftrk/rmsafe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rmsafe-1.2.0-py3-none-any.whl -
Subject digest:
4088db2890e6a4e5a7ecc2f4c4f214c937fb41ddd11a4f0e11665829a4dd7f36 - Sigstore transparency entry: 1389541852
- Sigstore integration time:
-
Permalink:
leftrk/rmsafe@fbf5b34deff37772088e2deab5473fd14fb48504 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/leftrk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fbf5b34deff37772088e2deab5473fd14fb48504 -
Trigger Event:
push
-
Statement type: