If you are looking for a command line tool that can be used to remove old files from the trash and thus remove the garbage from your GNU / Linux distribution, autotrash is the tool you were looking for. With it you will not have to be aware of cleaning or emptying the trash of your graphic environment every time you see it full. You will not have to check if the trash icon indicates that it is empty or full, because autotrash will do it periodically for you in a fully automated way so that you can dedicate yourself to other things.
That is, autotrash is a utility that allows you to purge old files that have been deleted by you and that have remained inside the recycle bin for a specified number of days that you can specify. After the established period of time, the tool will start up and delete the contents of the directory from the trash. Remember that in Linux environments it is usually stored in ~ / .Trash or other paths such as ~ / .local / share / Trash / files. It is there where all the deleted files that you have sent to the trash when you have not yet left it empty are housed.
The autotrash package is not rare, so you can find it in any repo of the most popular distros. So you can install using the package manager that you use frequently, for example with a sudo apt-get install autotrash would be enough in Debian and derivatives ... To program the tool to read temporary information about the trash in ~ / .local / share / Trash / info, you can use the following command , which would delete or empty the trash every month (30 days):
autotrash -td 30
If you don't use the -t option, and you only use -d, then they are only removed for the current user and not for all users. You can even use the –max-free or –min-free options to remove depending on the space maximum or minimum remaining on the partition where the trash can is housed. For example:
autotrash --max-free 2048 --min-free 1024 -d 30