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.3.0.tar.gz (126.5 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.3.0-py3-none-any.whl (46.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rmsafe-1.3.0.tar.gz
Algorithm Hash digest
SHA256 452e551d0cbfd4e5ea7661061f16fd5dad60a9ff152c1cad8972aeaa006feaca
MD5 115c96a68badcbf722691f3dd6b79af8
BLAKE2b-256 9182cc752af99724145704f4f702ae94c4657131907b1cc9cb3fcc089539e01c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rmsafe-1.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: rmsafe-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 46.8 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 95e4a0d9af9a92af8fe1a779cffc31816ff156c42dc95a66cd55fd3c09fa08dd
MD5 4fdac57505c1819bdbb8d4053cf63662
BLAKE2b-256 2fe2be06dbfeabab130a373dc42969bcb6e66a82144c3a27dd6abf1614b70de1

See more details on using hashes here.

Provenance

The following attestation bundles were made for rmsafe-1.3.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