In the event that you need to set your Ubuntu framework to consequently deal with your framework Trash over a specific timeframe, you can make utilization of the order line utility called autotrash. Autotrash is an utility that looks in a Trash envelope for data on its substance and after that cleanses a piece of the rubbish contingent upon your predetermined choices. In this article, we will disclose how to introduce, look for help on, and utilize the autotrash utility. We will expand on the strategy by displaying a few models that will assist you with the generally utilized elements of this utility. We have run the directions and methods referenced in this article on a Ubuntu 18.04 LTS framework.
Install Autotrash through the Command line We will install the autotrash command line utility through the Terminal application. You can launch the
Terminal either through the system application launcher search
or the Ctrl+Alt+T shortcut. Please note that only an authorized user can add/update, remove and configure software in Ubuntu.
Step1: Update your system’s current repositories index
In order to install the latest version of a software available in Ubuntu’s Internet repositories, your system’s repository index needs to be up-to-date.Run the following command as sudo in order to update your system’s current repository index with the
help of the Internet.
$ sudo apt-get update
The system ask you for the password of sudo to get install the updates. Enter the password and your Terminal will take action.
Your system will be updated if there is any update required terminal look like this
Step 2: Install autotarsh
Now, you can install the autotrash utility by running the following command as sudo in your Terminal application:
$ sudo apt-get install autotrash
The system prompt you with a Y/N option before starting the installation procedure. Please enter Y to continue.
Step 3: Verify autotrash installation
You can check the version number of your installed autotrash software and also verify if it is indeed installed on your system. Run the following command to do so:
$ autotrash --version
$ autotrash -V
You are now ready to use autotrash on your Ubuntu.
How to use autotrash? (with examples)
The autotrash help will tell you all you can do with this application. You can view the help as follows:
$ autotrash --help
For even more detailed information, you can view the manpage of autotrash by using the following command:
$ man autotrash
Now we will present some examples that will elaborate on how you can make the best use of this utility:
Example 1: Delete Files older than x number of days
This is the most broadly utilized element of autotrash. You can utilize the accompanying order sentence structure to consequently evacuate the records living in your framework junk for x number of days:
$ autotrash -d [days]
For example, the following command will remove the files that have completed their 30 days in the trash can.
$ autotrash -d 30
This gives you enough time to restore any files that you might wish to, during 30 days.The accompanying use of the direction gives you a chance to apply this component for your destroyed
documents as well as erased records of the considerable number of clients utilizing the framework:
$ autotrash -td [days]
$ autotrash -td 10
Example 2: Delete files based on free-space left Max-free
You can possibly utilize autotrash to cleanse records if there is not as much as M megabytes of free space left at the refuse area. For instance, on the off chance that you set this to 1024, at that point autotrash will possibly begin to work if there is under 1GB of free space in the waste. Till that time, autotrash will simply exit ordinarily without filtering the Trash catalog.
$ autotrash --max-free 1024 -d 30 Min-free
Similarly, you can use autotrash to make sure there is a minimum of M megabytes of free space.
$ autotrash --min-free 512
You can even join the two direction to ensure that autotrash begins perusing the rubbish in the event that there is under 1 GB of free space, and after that keep a mind. The order will at that point expel documents more seasoned than 10 days and furthermore evacuate additional records to guarantee that 512 MB of room is constantly accessible in the garbage.
$ autotrash --max-free 1024 --min-free 512 -d 10
Example 3: Delete M number of megabytes
You can utilize the utility to cleanse at any rate M number off megabytes, erasing most seasoned waste expansion first. This element utilizes junk passages instead of the individual files.This implies that if your most established destroyed thing is a 1GB index, and you demand at any rate 10MB to be expelled (M=10), autotrash will evacuate 512 MB.
$ autotrash –delete M
$ autotrash --delete 512
Presently you don’t have to stress over space wastage on your framework due to the framework garbage The autotrash utility will consequently deal with clearing your undesirable records dependent on your characterized criteria.