Skip to main content

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.

English | 中文

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

rmsafe-1.4.0.tar.gz (127.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rmsafe-1.4.0-py3-none-any.whl (48.1 kB view details)

Uploaded Python 3

File details

Details for the file rmsafe-1.4.0.tar.gz.

File metadata

  • Download URL: rmsafe-1.4.0.tar.gz
  • Upload date:
  • Size: 127.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rmsafe-1.4.0.tar.gz
Algorithm Hash digest
SHA256 ccef96b652289c36a860450f9c33321bf93b1bc4e774240bc26e45fed9722048
MD5 dc3fc72c9d7efed93189a2e29f9daace
BLAKE2b-256 3acf108985deaa180b2b687436804584dccdad592a19b09effdf44dec241285a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rmsafe-1.4.0.tar.gz:

Publisher: release.yml on leftrk/rmsafe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rmsafe-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: rmsafe-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 48.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rmsafe-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 563dca310337271f4bc72ada1fa47e6214e1794593155b69a73c124ad3b47b8d
MD5 9f0dc1a1015db3b5a4f5ce0174fe1165
BLAKE2b-256 99cb2329b458b07cab753a05a8620e73d6c9e50211466eca633383cb6f3603eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for rmsafe-1.4.0-py3-none-any.whl:

Publisher: release.yml on leftrk/rmsafe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page