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

# Homebrew
brew tap leftrk/rmsafe
brew install rmsafe

# pip / uv
pip install git+https://github.com/leftrk/rmsafe.git
uv tool install git+https://github.com/leftrk/rmsafe.git

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 --dev
uv run pytest  # 1030 tests

See CONTRIBUTING.md for details.

License

MIT

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.1.0.tar.gz (106.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.1.0-py3-none-any.whl (47.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rmsafe-1.1.0.tar.gz
  • Upload date:
  • Size: 106.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for rmsafe-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8fe90fc260853bd1146cde228217aa247093bdb389935861de0b2071a5c63337
MD5 a809136cd686030d02041b5578da5fd4
BLAKE2b-256 39b98efa79335d2d1acfc16a26a7766b8c0243ecf9344e4b1c2405b3d4c2b34f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rmsafe-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 47.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for rmsafe-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 514fc0d613a77c69f371ac48129dd83edbf9854fbb6e863d68d88e1d0dc18f2c
MD5 dc32eed256196c654a1c2f1914bcceb0
BLAKE2b-256 e4834f12f148e5ec52758903a226ebf87a0a9ae27f0ad739d5c688af84aef7c6

See more details on using hashes here.

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