Remove unnecessary packages
You can remove unnecessary packages from your system with the following command. It will automatically remove unused packages from your system.
$ sudo apt-get autoremove
Clean up apt-cache in Ubuntu
Run the following command to clear it.
$ sudo du -sh /var/cache/apt
You may also use any of the following commands to accomplish the same.
$ sudo apt-get autoclean $ sudo apt-get clean
Clean up System Logs
Every Linux system logs different kinds of information such as system messages, standard output and errors of various services in Ubuntu.
Here is the command to view the size of your system log.
$ sudo journalctl --disk-usage
Here is the command to restrict your system to log only information
for up to past 7 days.
$ sudo journalctl --vacuum-time=7d