Tool

resrm

rm replacement with undo/restore via a per-user trash.

Safety boundaries
  • Default behavior is move-to-trash, not permanent deletion
  • Permanent delete requires explicit --skip-trash
  • Trash is per-user (~/.local/share/resrm/files; /root/… under sudo)
  • Auto-prunes older than RESRM_TRASH_LIFE days (default 7, min 1)
resrm logo

Quickstart

resrm file1 file2
resrm -r mydir
resrm -l
resrm --inspect <id|name>
resrm --restore <id|name>
resrm --empty
resrm --skip-trash file   # permanent delete
Tip: every page has copy buttons on code blocks.

Key features

Undoable deletes
Recover files and directories from trash.
Fast restore
Restore by short ID or exact basename.
Inspect metadata
See original path and timestamps before restoring.

How it works

Step 1
Trash instead of delete
resrm moves items into a per-user trash directory.
Step 2
List & inspect
Use -l and --inspect to find the item you want.
Step 3
Restore or empty
Restore by id/name, or empty trash intentionally.
TIP: Once you alias rm to resrm you will barely see the difference.

Reference & examples

Everything for this tool on one page: options, behaviour notes, and copy-paste examples.

Restore & inspect

List trash

resrm -l

Inspect an item

Shows full details (original path, timestamps, etc.).

resrm --inspect <id|name>

Restore

resrm --restore <id|name>

You can restore by short ID or exact basename.

Using with sudo

PyPI + sudo

To use resrm with sudo, root must be able to find it in $PATH. Either install as root, or add your user’s bin directory to secure_path in /etc/sudoers.

Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/user/.local/bin"

Packages avoid this

If you install via the GuardUtils APT/DNF repository, sudo works out of the box.

Trash & pruning

Trash location

  • Normal users: ~/.local/share/resrm/files
  • Root user: /root/.local/share/resrm/files

Auto-pruning

Entries older than RESRM_TRASH_LIFE days are pruned automatically (default 7, minimum 1).

export RESRM_TRASH_LIFE=10

Empty trash

resrm --empty

Usage & flags

Basic usage

# Move files to trash
resrm file1 file2

# Recursive remove of a directory
resrm -r mydir

Compatible rm-style flags

resrm -f file     # ignore nonexistent
resrm -i file     # interactive

Permanent delete

By default resrm is undoable. For immediate deletion, opt in explicitly:

resrm --skip-trash file