📜  auto clean ubuntu - Shell-Bash (1)

📅  最后修改于: 2023-12-03 14:59:25.386000             🧑  作者: Mango

Auto Clean Ubuntu - Shell-Bash

Auto Clean Ubuntu is a shell script that automates the process of cleaning up unnecessary files on Ubuntu-based systems. This script is designed to free up disk space, speed up your system and make maintenance tasks easier and more efficient.

Features
  • Removes old kernels and associated packages to free up disk space
  • Cleans up unused packages
  • Purges unused configuration files
  • Cleans apt cache
  • Removes temporary files
  • Cleans up thumbnails
How to Use
  1. Download the script from GitHub.
  2. Open a terminal and navigate to the directory where the script is downloaded.
  3. Make the script executable by running the command chmod +x auto_clean_ubuntu.sh.
  4. Execute the script by running the command ./auto_clean_ubuntu.sh.
Code Snippet
#!/bin/bash

# Remove old kernels
sudo apt-get autoremove
sudo apt-get autoclean

# Clean up unused packages
sudo apt-get remove --purge $(dpkg --get-selections | grep deinstall | awk '{print $1}')

# Remove unused configuration files
sudo apt-get purge $(dpkg -l | grep '^rc' | awk '{print $2}')

# Clean apt cache
sudo apt-get clean

# Remove temporary files
sudo find /var/tmp -type f -delete
sudo find /tmp -type f -delete

# Clean up thumbnails
rm -rf ~/.cache/thumbnails/*
Conclusion

Auto Clean Ubuntu is a simple but powerful tool that automates maintenance tasks on Ubuntu-based systems. By running this script regularly, you can keep your system running smoothly and free up valuable disk space.