trash-cli: Command Line Utility to Access Trashcan in Ubuntu Linux from Terminal
trash-cli is a command line utility to access the “Trash” in Ubuntu Linux from the terminal. You can use trash-cli to search the deleted files in trashcan , view them , restore them and empty the trash as well.
trash-cli trashes files by recording the original path, deletion dated, and permissions. You can install trash-cli in Ubuntu 12.04, 11.10 , 11.04, and 10.10 by running following commands in the terminal.
sudo apt-get install trash-cli
Once installed, you have to run trash-cli from the terminal. trash-cli makes use of following four commands to perform the corresponding tasks as described below.
- restore-trash: restores deleted items from the trash
- trash-empty: deletes files from the trash
- trash-list: shows the lists of files
- trash-put: deletes the files and directories into the trash
So, in order to delete a file and directory into the trash , you have to run following commands in the terminal.
where <filename> is the name of the file or directory.
In order to empty the trash completely , you have to run the following commands in the terminal.
In order to delete only the files that have deleted some days ago , you have to run the following commands in the terminal.
where <days> is the number of the day at which the files were deleted into the trash.
In order to list all the files deleted into the trash, you have to run the following commands in the terminal.
In order to search for a particular file deleted into the trash, you have to run the following commands in the terminal.
trash-list | grep <filename>
where , <filename> is the name of the file to be searched.