trash-cli is a command-line interface for managing the trash or recycle bin in Unix-like operating systems. It allows users to move files and directories to the trash instead of permanently deleting them with the rm command. This provides a safety net, as files can be easily restored from the trash if needed.
Key Features of trash-cli:
-
Move to Trash: Instead of deleting files permanently,
trash-climoves them to the trash, allowing for easy recovery.trash file_name -
List Trash Contents: You can view the contents of the trash with:
trash-list -
Restore Files: You can restore files from the trash back to their original location.
trash-restore -
Empty Trash: To permanently delete all files in the trash, you can use:
trash-empty -
Cross-Platform:
trash-cliworks on various Unix-like systems, including Linux and macOS.
Installation:
You can install trash-cli using your package manager. Here are some examples:
-
Debian/Ubuntu:
sudo apt install trash-cli -
Fedora:
sudo dnf install trash-cli -
macOS (using Homebrew):
brew install trash
Example Usage:
-
Move a File to Trash:
trash myfile.txt -
List Files in Trash:
trash-list -
Restore a File:
trash-restore -
Empty the Trash:
trash-empty
Using trash-cli can help prevent accidental data loss by providing a way to recover deleted files easily. If you have any further questions or need assistance, feel free to ask!
