rmw - safe-remove utility for the command line
rmw [OPTION]… FILE…
Move FILE(s) to a WASTE directory listed in configuration file
rmw -s
rmw -u
rmw -z FILE…
Restore FILE(s) from a WASTE directory
rmw (ReMove to Waste) is a trashcan/recycle bin utility for the command line. It can move and restore files to and from directories specified in a configuration file, and can also be integrated with your regular desktop trash folder (if your desktop environment uses the FreeDesktop.org Trash specification). One of the unique features of rmw is the ability to purge items from your waste (or trash) directories after x number of days.
-h, --help-c, --config FILE-l, --listAdd -v to also show each folder’s attributes (such as “no-add”)
and a list of candidate trash locations that rmw would create on other
file systems when needed.
-g[N_DAYS], --purge[=N_DAYS]-g90, --purge=90)
By default, purging is disabled (‘expire_age’ is set to ‘0’ in the configuration file). To enable, set the ‘expire_age’ value in your config file to a value greater than ‘0’
You can use ‘-vvg’ to see when the remaining files in the waste directories will expire.
The argument must be attached to the option, as in the examples above. If a space separates them, rmw reads ‘N_DAYS’ as the name of a file to remove.
To purge from a scheduled job, keep ‘expire_age’ at ‘0’ so that normal runs never purge, and let a cron job give the number of days:
30 4 * * 0 rmw -g45 >> "$HOME/.local/state/rmw-purge.log" 2>&1
See the FAQ for the full example, including log rotation: https://theimpossibleastronaut.github.io/rmw-website/faq.html#can-rmw-be-run-as-a-scheduled-job-to-purge-expired-files
-o, --orphanedAn orphan is an item in a waste directory that has no corresponding .trashinfo file, or vice versa. This option is intended primarily for developers. Orphans may happen while testing code changes or if rmw is unintentionally released with a bug.
A file that has no .trashinfo is repaired by -o alone (a new
.trashinfo is created for it). Deleting the opposite kind of orphan, a
.trashinfo with no matching file, is only done during a purge and
requires force to be given twice, as in rmw -offg (-o -f -f -g).
(see also:
https://theimpossibleastronaut.github.io/rmw-website/faq.html#dot_trashinfo)
-f, --forceBy default, force is not required to enable the purge feature. If you would like to require it, add ‘force_required’ to your config file.
--empty-r, -R, --recursive--top-level-bypass-v, --verbose-w, --warranty-V, --version-z, --restore FILE(s)When restoring an item, if a file or directory with the same name already exists at the destination, the item being restored will have a time/date string (formatted as “_%H%M%S-%y%m%d”) appended to it (e.g. ‘foo_164353-210508’).
-s, --selectDisplays a list of items in your waste directories. You can use the left/right cursor keys to switch between waste directories. Use the space bar to select the items you wish to restore, then press enter to restore all selected items.
-u, --undo-lastRestores files that were last rmw’ed
-m, --most-recent-listConfiguration is optional. With no configured WASTE folder, rmw moves each file to the trash on the file’s own filesystem: files on the home filesystem go to the FreeDesktop home trash (~/.local/share/Trash, the same trash your desktop uses), and files on other filesystems go to a trash at the top of that filesystem. These are created when first needed.
Add WASTE lines only for special cases, such as keeping rmw’s files separate from the desktop trash (uncomment the WASTE = $HOME/.local/share/Waste line in the generated config), a folder on removable media, or a no-add folder. Each WASTE folder must be on its own line; two WASTE folders cannot be specified on the same line.
These variables are set by rmw’s meson test suite to run the code in a controlled environment. They are not meant for normal use, and setting them yourself is strongly discouraged. See the code-testing page on the rmw website for more details.
On some systems, $HOME/.config and $HOME/.local/share may be replaced with $XDG_CONFIG_HOME and $XDG_DATA_HOME
rmw does not move items from one file system to another. When you rmw a file, it looks for a waste directory on the same file system. It checks the waste directories in your configuration file first. If none match, it uses the trash for that file system, as described by the FreeDesktop.org Trash specification: the home trash (~/.local/share/Trash) for files on the home file system, or a trash at the top of the file system (for example, “/mnt/disk/.Trash-1000”) for other file systems. If one already exists, rmw uses it; if not, rmw creates it. (Moves between btrfs or bcachefs subvolumes are the exception; see BTRFS AND BCACHEFS below.)
rmw does not create a trash directory on file systems that are not meant to hold one, such as temporary (tmpfs) or network file systems. On those, if no configured waste directory matches, rmw refuses to remove the file, the same way desktop file managers do. A trash directory that already exists on such a file system is still used.
Because the default home trash is the same one your desktop uses, enabling purging (an expire_age greater than 0) lets rmw permanently delete old items that your file manager placed in the trash too, not only items removed with rmw. Purging is off by default.
Items are moved to the trash in the same manner as the “move to trash” option in your desktop file manager. By default rmw uses the same trash your desktop uses (the FreeDesktop home trash, ~/.local/share/Trash), so an item removed with rmw appears in your desktop trash and can be restored from either one.
To keep rmw’s files separate from the desktop trash instead, uncomment this line in your configuration file:
WASTE = $HOME/.local/share/Waste
(On macOS rmw does not integrate with the system trash; the default ~/.local/share/Trash is used.)
When rmw’ing an item, if a file or directory with the same name already exists in the waste (or trash) directory, it will not be overwritten; instead, the current file being rmw’ed will have a time/date string (formatted as “_%H%M%S-%y%m%d”) appended to it (e.g. ‘foo_164353-210508’).
The first time rmw is run, it will create a configuration file. Waste directories will be created automatically (Except for when the ‘,removable’ option is used; see below) e.g., if ‘$HOME/.local/share/Waste’ is uncommented in the config file, these two directories will be created:
$HOME/.local/share/Waste/files
$HOME/.local/share/Waste/info
If a WASTE directory is on removable media, you may append ‘,removable’. In that case, rmw will not try to create it; it must be initially created manually. When rmw runs, it will check to see if the directory exists (which means the removable media containing the directory is currently mounted). If rmw can’t find the directory, it is assumed the media containing the directory isn’t mounted and that directory will not be used for the current run of rmw.
With the media mounted, once you manually create the waste directory for that device (e.g. “/mnt/flash/.Trash-$UID”) and run rmw, it will automatically create the two required child directories “files” and “info”.
rmw supports moving files across subvolumes on btrfs and bcachefs filesystems. Because the kernel reports subvolumes with different device numbers, a cross-subvolume move would normally fail with a cross-device error; rmw detects this case and performs a reflink clone-then-delete instead, preserving the expected trash semantics.
To use this feature, define a WASTE directory on the destination subvolume in your configuration file. If your waste directory is on a different subvolume than the files you want to remove, rmw will handle the move transparently.
rmw -z ~/.local/share/Waste/files/foo
rmw -z ~/.local/share/Waste/files/bars*
Project Manager: Andy Alt
The RMW team: see AUTHORS.md
Report bugs to https://github.com/theimpossibleastronaut/rmw/issues.
Copyright © 2012-2025 Andy Alt
License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
mv(1), rm(1), rmdir(1)
Full documentation at: https://theimpossibleastronaut.github.io/rmw-website/
Powered by jekyll
This website was last updated on Jun 18th, 2026