This script is a mock recycle bin for Linux terminals. So far, it can do the following:
- Delete files by moving them to a recycle bin
- Restore files to their original directory
- Autodelete files after 30 days (30 days of running your computer for at least 10 minutes)
- If an incoming file has the same name as a file in the trash folder, it prompts the user to rename the file before deleting it.
- Download the trash script.
- Move the trash script to the /usr/local/bin folder.
sudo mv -i [trash script path] /usr/local/bin
The-i
ensures that you do not automatically overwrite any existing binary with the same name. - cd to the /usr/local/bin
cd /usr/local/bin
- Make the trash script executable for others
sudo chmod o+x trash
- Activate the autodelete-after-30 days function by adding the following to your anacrontab (sudo nano /etc/anacrontab)
1 10 count-autodelete trash -c
- Move a file to the /trash directory:
trash -d [FILE]
- Restore a file from the /trash folder to its original directory:
trash -r [FILE]