Groot Trash
Groot Trash is the powerful and versatile trash management utility for Linux that brings user‑friendly control into the command line. Think of it as a modern replacement for the traditional trash-cli, featuring hooks for scalable systems, automated cleanup schedules, and a clean API that integrates seamlessly with desktop environments. Developers love it for its extensibility, and power users praise its simplicity when handling large volumes of files.
What is Groot Trash?
Groot Trash is a lightweight binary written in Go, capable of creating a trash directory tree that follows the FreeDesktop Trash Specification. It accepts standard input paths, converts them to EXIF metadata, and moves them to a hidden .local/share/Trash directory. The application additionally exposes a groot-trash --list command to retrieve the trash content and a groot-trash --restore command for easy recovery.
Core Features Highlighted
- Cross‑distribution compatibility: Works on Debian, Fedora, Arch, and macOS via
brew. - Smart folder limits: Auto‑purge older items when trash size hits a defined threshold.
- Metadata retention: Stores original file paths, timestamps, and MIME types.
- Language bindings: Offers Python and Rust wrappers.
- Logging & reporting: Verbose mode records each move here for audit trails.
Installation & Quick Start
Below is a concise guide for installing groot-trash on popular platforms with the minimal steps needed.
| Distribution | Command |
|---|---|
| Debian/Ubuntu | sudo apt-get install groot-trash |
| Fedora | sudo dnf install groot-trash |
| Arch Linux | sudo pacman -S groot-trash |
| macOS | brew install groot-trash |
Once installed, try offloading a single file:
groot-trash /path/to/your/file.txt
Verify its existence in the trash:
groot-trash --list
To restore, run:
groot-trash --restore file.txt
And in case you want to purge permanently:
groot-trash --empty
💡 These commands showcase the core workflow: move, review, restore, and purge. Each action is lightweight and can be monkey‑patched or scripted for bulk operations.

Using Groot Trash in Scripts
Often, you’ll want to embed trash operations in a cleanup script or cron job. Here’s a simple pattern:
#!/usr/bin/env bash
# Clean /tmp, but keep recent logs
TEMP_DIR="/tmp"
for file in "$TEMP_DIR"/*; do
# Skip logs older than 7 days
if [[ "$(stat -c %Y "$file")" -gt "$(date -d '7 days ago' +%s)" ]]; then
continue
fi
groot-trash "$file"
done
That script loops through /tmp, filters by age, and moves eligible files. Groot Trash preserves paths, so re‑adding file to /tmp can automatically restore the original location with groot-trash --restore .
📝 Note: When scripting, use --quiet to suppress verbose logs and keep the output tidy.
Advanced Configuration: Setting a Max Trash Size
The built‑in config file ~/.config/groot-trash/config.toml lets you tune several settings. Open it in your editor and add:
[trash]
max_size_mb = 1024
expiry_days = 30
purge_on_start = true
Explanation:
max_size_mbcaps trash at 1 GB.expiry_daysremoves items older than 30 days automatically.purge_on_startforces a purge each time you start a session.
Whenever you update the config, run groot-trash --configure to reload defaults.
💡 Using purge_on_start is particularly valuable on shared servers to enforce privacy compliance.
Integrating with Desktop Environments
On GNOME or KDE, you can set Groot Trash as the default Trash handler by pointing the org.gnome.desktop.default-applications.terminal or KDE’s file menu setting to groot-trash %U. The app registers the same MIME types as the existing trash, so all user‑level actions (right‑click → Delete) will trigger Groot Trash instead of “trash‑cli.”
📝 Note: After changing the handler, you may need to log out and back in for the change to propagate across the session.
Security & Privacy Implications
Unlike some trash tools that copy files into a generic hidden directory, Groot Trash keeps a separate /tmp copy with a unique fingerprint. Even if the original file was attached to an email, its content remains protected until the --empty command or the expiry rule triggers deletion.
By default all moving operations are logged to $HOME/.cache/groot-trash/operations.log. This file can be rotated or secured with chmod 600 to comply with the most restrictive audit policies.
Frequently Asked Questions
📝 Note: For more extensive usage, refer to the official command help via groot-trash –help.
Final thoughts: Whether you are a system administrator bundling groot-trash into your ISO or a hobbyist juggling dozens of game files, the flexibility and clarity of Groot Trash make the extra space you waste on “trash” less painful. The tool’s programmable facets ensure a clean environment, while the minimal footprint preserves system resources. In a world where files keep piling up, having a trustworthy, automated cleaner is not just convenient—you could call it indispensable.
What operating systems support Groot Trash?
+
Groot Trash runs on major Linux distributions—Debian, Ubuntu, Fedora, Arch—and macOS through Homebrew. It is compiled for both x86_64 and ARM architectures.
Can I limit the trash size automatically?
+
Yes. Edit ~/.config/groot-trash/config.toml and set max_size_mb and expiry_days. Groot Trash will purge old files when thresholds are exceeded.
How does Groot Trash differ from trash-cli?
+
It uses Go for performance, supports automated purging, keeps detailed logs, and offers language bindings. The command syntax is similar but includes advanced options.