Below is the script I use to clean the system. All you have to do to be able to use this script is to copy the code and enter it in a file with the extension .sh ex: curatare.sh

! Note: This script can only be used on Debian-based distributions. On other distributions it is not useful.

#! / bin / bash

OLDCONF = $ (dpkg -l | grep "^ rc" | awk '{print $ 2}')
CURKERNEL = $ (uname -r | sed 's / - * [az] // g' | sed 's / -386 // g')
LINUXPKG = "linux- (image | headers | ubuntu-modules | restricted-modules)"
METALINUXPKG = "linux- (image | headers | restricted-modules) - (generic | i386 | server | common | rt | xen)"
OLDKERNELS = $ (dpkg -l | awk '{print $ 2}' | grep -E $ LINUXPKG | grep -vE $ METALINUXPKG | grep -v $ CURKERNEL)

if [$ USER! = root]; then
  echo -e "Error: You must be an administrator"
  echo -e "Exit ..."
  exit 0
be

echo "\ 033 [1; 34m Delete Arabic / Asian fonts \ 033 [0m"
sleep 2
sudo apt-get remove -y ttf-arabeyes ttf-indic-fonts-core ttf-kochi-gothic ttf-kochi-mincho fonts-lao ttf-malayalam-fonts fonts-thai-tlwg ttf-unfonts-core ttf-punjabi-fonts ttf-indic-fonts
sleep 2

echo "\ 033 [1; 34m Clear apt cache and .deb packages ... \ 033 [0m"
sleep 2
apt-get -y clean
apt-get -y remove
apt-get -y autoclean
apt-get -y autoremove
rm /var/cache/apt/*.bin

echo "\ 033 [1; 34m Delete logs \ 033 [0m"
sleep 2
rm / var / log / * 
rm / var / log / * / *
sleep 2
echo

echo "\ 033 [1; 34m Delete unnecessary language files"
echo "\ 033 [1; 34m Choose the languages ??you want to keep in the system. Unselected languages ??will be deleted. \ 033 [0m" 
sleep 4
echo
apt-get install -y localepurge
sleep 1
localepurge
sleep 2

echo "\ 033 [1; 34m Deleting thumbnails files \ 033 [0m"
sleep 2
if $ CONF_THUMBNAILS; then
 THUMBNAILS = $ (find $ HOME / .thumbnails -type f)
 if ["$ THUMBNAILS"! = ""]; then
  find $ HOME / .thumbnails -type f -delete -print
 be
be
sleep 2

echo "\ 033 [1; 34m Delete old configuration files ... \ 033 [0m"
sleep 2
apt-get purge -y $ OLDCONF
if $ CONF_RESIDUAL_CONFIGS; then
 PKGS = $ (dpkg -l | grep '^ rc' | tr -s '' | cut -d '' -f 2)
 if ["$ PKGS"! = ""]; then
  dpkg --purge $ PKGS
 be
be
sleep 2

echo "\ 033 [1; 34m Delete orphaned packages .deb \ 033 [0m"
sleep 2
if $ CONF_DEBORPHAN; then
 if which deborphan> / dev / null; then
  sudo deborphan -e $ DEBORPHAN_EXCLUDE | xargs sudo apt-get -y purge
  sudo deborphan --guess-all
 be
be
sleep 2

echo "\ 033 [1; 34m Delete old kernel ... \ 033 [0m"
sleep 2
apt-get purge -y $ OLDKERNELS
dpkg -l 'linux- *' | sed '/ ^ ii /! d; /' "$ (uname -r | sed" s /\(.*\)-\([^ 0-9] \ + \) / \ 1 / ")" '/ d; s / ^ [^] * [^] * \ ([^] * \). * / \ 1 /; / [0-9] /! d '| xargs sudo apt-get -y purge
sleep 2

echo "\ 033 [1; 34m Empty trash cans ... \ 033 [0m"
sleep 2
rm -rf /home/*/.local/share/Trash/*/** &> / dev / null
rm -rf /root/.local/share/Trash/*/** &> / dev / null
rm -rfv $ HOME / .local / share / Trash / * / **
sleep 2

echo "\ 033 [1; 34m Fixing packages \ 033 [0m"
sleep 2
apt-get -u --reinstall --fix-missing install
sleep 2

echo "\ 033 [1; 34m Clean and ready! \ 033 [0m"

  • What is your reaction?
  • powered by Verysign
  • like gnulinux.ro
    Like
  • unmoved gnulinux.ro
    Unmoved
  • amused gnulinux.ro
    Amused
  • excited gnulinux.ro
    Excited
  • angry gnulinux.ro
    Angry
  • sad gnulinux.ro
    Sad
TENDINTA  |  NuTyX 21.10.0 + cards 2.4.138
OlderGNU                   gnulinux.ro
OlderGNU
Continut din vechiul website
82 articole
In context



  • Comment
  • powered by Verysign

Nici un comentariu inca. Fii primul!