Clean Up Script On Ubuntu

Many applications in Ubuntu such as clean up one of his BleachBit. We can make your own clean-up script, if you want to try it, will you follow this step by step manner.
Open your text editor application, I use gedit and then copy the script below and paste it in your text editor, then save with clean.sh name and file type .sh, put the directory in the directory / home / user

#!/bin/bash
#
# currently this simple maintenance script performs the following functions:
#   > apt-get clean
#   > apt-get autoclean
#   > apt-get autoremove
#   > apt-get purge
#   > delete orphaned packages
#   > delete residual config files
#   > delete thumbnails (current user)
#   > delete thumbnails (root)
#   > delete mozilla cache (current user)
#   > delete mozilla cache (root)
#   > delete trash (current user)
#   > delete trash (root)
#
# requires the following packages in addition to those provided by a default Ubuntu installation:
#   > deborphan (for identifying orphaned packages) - to install, type: sudo apt-get install deborphan
#   > wajig (for purging residual config files) - to install, type: sudo apt-get install wajig
#
# NOTES:
#
# 1) This script assumes that certain files/folders are in their default Ubuntu locations. If you are
#    getting 'No such file or directory' errors then look through the script below to see if your
#    files/folders are located where the script is expecting them and edit as necessary.
# 2) The goal of this script was to do a system cleanup as quickly and efficiently as possible. Some
#    functions do require confirmation but some run without user input. Because of this and the fact
#    that this script's primary purpose is to delete data from your hard drive, it should be used with
#    caution. THE ACTIONS OF THIS SCRIPT CAN NOT BE UNDONE. If you do not understand all of the
#    functions listed above, it is suggested that you gain a passing knowledge of each. The Ubuntu man
#    pages, Google search, and openubuntu.com will provide more than enough information.
# 3) The reason for deleting some files in /root may not be obvious. Picture this scenario. You open a
#    nautilus session as administrator where you send some image files to the trash and look something
#    up on the internet. Now you have created thumbnail files and mozilla cache files saved under /root
#    and the files that you trashed are sitting in /root/.local/share/Trash/files/. All of these files
#    are easily forgotten and require root access to delete when doing a manual cleanup.
# 4) This script requires a one-time setup which is as easy editing three lines listed immediately
#    below to provide information to enable the script to find your files/folders. After editing and
#    saving the file make sure that the file is executable by setting the permissions in nautilus or
#    by typing: sudo chmod +x /path/to/file/cleanup.sh
#
# ======================================================================================================
#
# CONFIGURATION:
#
#   change "tgeer" in the following line to reflect your username (leave the double-quotes intact):
username="tgeer"
#
# change xxxxxxxx in the following line to your mozilla profile name. You can find this information by
#   looking in /home/username/.mozilla/firefox for a folder with a name in the format xxxxxxxx.default
#   where xxxxxxxx is an eight character random alphanumeric string. The eight character string is your
#   mozilla profile name. ie. if the folder is named te3n7ssp.default then your profile name is: te3n7ssp.
userprofile="vkuuxfit"
#
#   change yyyyyyyy in the following line to root's mozilla profile name. Use the same method as above to
#   find it but look in /root/.mozilla/firefox instead.
rootprofile="etjkoe2b"
#
#
homepath="/home/"$username"/"
#
# =======================================================================================================
#
printf "\nThis script will clean up your Ubuntu installation by removing packages and files which are no longer needed. The actions performed will delete data from your drive and CANNOT BE UNDONE. Proceed with caution and only if you know what you are doing.\n\n"
read -p "Run the system cleanup script? (y/N): " confirm
[ "$confirm" != "y" ] && printf "\nAborted\n\n" && exit 1
printf "\n-------------------------------------------\n"
sudo apt-get clean
printf "## apt-get clean - Done ###\n"
sudo apt-get autoclean
printf "### apt-get autoclean - Done ###\n"
sudo apt-get autoremove
printf "### apt-get autoremove - Done ##\n"
sudo apt-get purge
printf "### apt-get purge - Done ##\n"
sudo deborphan | xargs sudo apt-get -y remove --purge
printf "### remove ophaned packages - Done ###\n"
for pkg in `grep -B1 config-files /var/lib/dpkg/status | grep -v -- '--' | grep -v 'Status:' | awk '{ print $2 }' `; do
wajig purge $pkg
done
printf "### remove residual config files - Done ###\n"
rm -rf $homepath.thumbnails/normal/*
sudo sh -c "rm -rf /root/.thumbnails/normal/*"
printf "### delete thumbnails - Done ##\n"
rm -rf $homepath.mozilla/firefox/$userprofile.default/Cache/*
sudo sh -c "rm -rf /root/.mozilla/firefox/$rootprofile.default/Cache/*"
printf "### delete mozilla cache - Done ###\n"
sudo rm -rf /var/cache/apt/archives/*.deb
printf "### delete package archives - Done ###\n"
sh -c "rm -rf $homepath.local/share/Trash/*"
sudo sh -c "rm -rf /root/.local/share/Trash/*"
printf "### delete trash - Done ###\n"
printf "\a----------------------------------------------------\n"
printf "Maintenance script finished\n\n"
exit 0

Open a terminal typing
Change into executable
    chmod + x clean.sh

create an alias in the script
    alias cleanup = "~ / Scripts / clean.sh"

run script
    cleanup


Untuk Download Artikel Klik Gambar

Baca Artikel Terkait :

1 komentar:

MOHON DIKOREKSI JIKA SAYA SALAH
===============================
||||||| Blog ini Dofollow |||||||||
===============================
Silahkan Meninggalkan Komentar Soba ... :)
saling bersilahturahmi saya juga akan berkunjung keblog Sobat.

Untuk Sobat Yang Ikut Kontes Seo SilahKan Berkomentar Dengan Keyword Kontes Nya. Semoga Membantu !!

Tukeran link yuk teman klik halaman sini

Untuk sobat yang tidak sempat di balas komentnya silahkan baca ini ya : :D
keep blogging