Skip to main content

Licence Gitea Release pre-commit

resrm

resrm logo

resrm is a safe, drop-in replacement for the Linux rm command with undo/restore support. It moves files to a per-user trash instead of permanently deleting them, while still allowing full sudo support for root-owned files.


Features

  • Move files and directories to a Trash folder instead of permanent deletion

  • Restore deleted files by short ID or exact basename

  • Empty trash safely

  • Supports -r, -f, -i, --skip-trash options

  • Works with sudo for root-owned files

  • Automatically prunes Trash entries older than $RESRM_TRASH_LIFE days (default 7, minimum 1)

    Note: if you need immediate deletion, use the --skip-trash flag.

Installation

From the SysMD package repository

This is the preferred method of installation.

Debian/Ubuntu

1) Import the GPG key

sudo mkdir -p /usr/share/keyrings
curl -fsSL https://repo.sysmd.uk/sysmd/sysmd.gpg | sudo gpg --dearmor -o /usr/share/keyrings/sysmd.gpg

The GPG fingerprint is 0032C71FA6A11EF9567D4434C5C06BD4603C28B1.

2) Add the APT source

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/sysmd.gpg] https://repo.sysmd.uk/sysmd/debian stable main" | sudo tee /etc/apt/sources.list.d/sysmd.list

3) Update and install

sudo apt update
sudo apt install resrm

Fedora/RHEL

1) Import the GPG key

sudo rpm --import https://repo.sysmd.uk/sysmd/sysmd.gpg

2) Add the repository configuration

sudo tee /etc/yum.repos.d/sysmd.repo > /dev/null << 'EOF'
[sysmd]
name=SysMD Repository
baseurl=https://repo.sysmd.uk/sysmd/rpm/$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://repo.sysmd.uk/sysmd/sysmd.gpg
EOF

4) Update and install

sudo dnf upgrade --refresh
sudo dnf install resrm

From PyPI

NOTE: To use resrm with sudo, the path to resrm must be in the $PATH seen by root.
Either:

  • install resrm as root, or
  • add the path to resrm to the secure_path parameter in /etc/sudoers. For example, where /home/user/.local/bin is where resrm is:
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/user/.local/bin"

Install with:

pip install resrm

From this repository

git clone https://git.sysmd.uk/guardutils/resrm.git
cd resrm/
poetry install

Usage

# Move files to trash
resrm file1 file2

# Recursive remove of a directory
resrm -r mydir

# Force remove (ignore nonexistent)
resrm -f file

# Interactive remove
resrm -i file

# Permanent delete (bypass trash)
resrm --skip-trash file

# List trash entries
resrm -l

# Restore a file by ID or basename
resrm --restore <id|name>

# Show full details of trashed item
resrm --inspect <id|name>

# Empty the trash permanently
resrm --empty

Trash Location

Normal users: ~/.local/share/resrm/files

Root user: /root/.local/share/resrm/files

Configuration

To control how long trashed files are kept, add this line to your shell configuration (e.g. ~/.bashrc):

export RESRM_TRASH_LIFE=10

TAB completion

Add this to your .bashrc

eval "$(register-python-argcomplete resrm)"

And then

source ~/.bashrc

pre-commit

This project uses pre-commit to run automatic formatting and security checks before each commit (Black, Bandit, and various safety checks).

To enable it:

poetry install
poetry run pre-commit install

This ensures consistent formatting, catches common issues early, and keeps the codebase clean.

Support

If you find resrm useful, consider supporting its development:

Support me on Ko-fi

Metadata

Release files for resrm 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for resrm 0.5.1
File Size Uploaded Provenance Actions
resrm-0.5.1.tar.gz 19.4 kB Without provenance Details for resrm-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for resrm 0.5.1
File Interpreter ABI Platform Actions
resrm-0.5.1-py3-none-any.whl Python 3 none any Details for resrm-0.5.1-py3-none-any.whl

Total release size: 39.9 kB

Release files / resrm-0.5.1.tar.gz

Download URL resrm-0.5.1.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0098aeaea5f68c1550064781ab1a364e07d1a2972e26bdaa1d3751753ecd7a79
BLAKE2b-256 checksum
How to use checksums
dc501bb1c408a7c35713e3a39108bb250fdb9bc416b3441f773eea98a36a88af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.0 CPython/3.14.7 Linux/7.2.9-100.fc43.x86_64

Release files / resrm-0.5.1-py3-none-any.whl

Download URL resrm-0.5.1-py3-none-any.whl
Size 20.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
662d3b844147efc1020e99b5b0356e34dfe677ad33dab9bd318cb0716bfa8d83
BLAKE2b-256 checksum
How to use checksums
aef5bbfb4aaa1690d21f278c54b3f466506ed20c5a7a6dccbea5b0f0f2bc486a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.0 CPython/3.14.7 Linux/7.2.9-100.fc43.x86_64

Security for resrm 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page