Cara Delete Old Kernel Linux

Cara bagaimana untuk mendelete chace dan old linux kernel dan caranya sebagai berikut :

 bikin notpad.txt copy kan script berikut lalu rename notepad dengan nama mintcleaner.sh




 #!/bin/bash
 OLDCONF=$(dpkg -l|grep "^rc"|awk '{print $2}')
CURKERNEL=$(uname -r|sed 's/-*[a-z]//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)
YELLOW="\033[1;33m"
RED="\033[0;31m"
ENDCOLOR="\033[0m"
 if [ $USER != root ]; then
  echo -e $RED"Error: must be root"
  echo -e $YELLOW"Exiting..."$ENDCOLOR
  exit 0
fi
 echo -e $YELLOW"Cleaning apt cache..."$ENDCOLOR
aptitude clean
 echo -e $YELLOW"Removing old config files..."$ENDCOLOR
sudo aptitude purge $OLDCONF
echo -e $YELLOW"Removing old kernels..."$ENDCOLOR
sudo aptitude purge $OLDKERNELS
echo -e $YELLOW"Emptying every trashes..."$ENDCOLOR
rm -rf /home/*/.local/share/Trash/*/** &> /dev/null
rm -rf /root/.local/share/Trash/*/** &> /dev/null
rm -rf /home/*/.cache/*/** &> /dev/null
rm -rf /home/*/.linuxmint/*/** &> /dev/null
echo -e $YELLOW"Script Finished!"$ENDCOLOR









langkah pertama , tekan ctrl alt t lalu ketikan :

sudo chmod +x mintcleaner.sh

langkah kedua:
sudo sh mintcleaner.sh


contoh hasilnya seperti berikut ini :



=============================================
Do you want to continue? [Y/n/?] y
(Reading database ... 220602 files and directories currently installed.)
Removing hexchat (2.10.2-1ubuntu3) ...
Purging configuration files for hexchat (2.10.2-1ubuntu3) ...
Processing triggers for menu (2.1.47ubuntu1) ...
(Reading database ... 220602 files and directories currently installed.)
Removing libgtk2.0-0:i386 (2.24.30-1ubuntu1.16.04.2) ...
Removing libdbusmenu-gtk4:i386 (16.04.1+16.04.20160927-0ubuntu1) ...
Removing libatk1.0-0:i386 (2.18.0-1) ...
Removing libpangocairo-1.0-0:i386 (1.38.1-1) ...
Removing libcairo2:i386 (1.14.6-1) ...
Removing libpangoft2-1.0-0:i386 (1.38.1-1) ...
Removing libpango-1.0-0:i386 (1.38.1-1) ...
Removing libthai0:i386 (0.1.24-2) ...
Removing libdatrie1:i386 (0.2.10-2) ...
Removing libdbusmenu-glib4:i386 (16.04.1+16.04.20160927-0ubuntu1) ...
Removing libnotify4:i386 (0.7.6-2svn1) ...
Removing libgdk-pixbuf2.0-0:i386 (2.32.2-1ubuntu1.3) ...
Removing libharfbuzz0b:i386 (1.0.1-1ubuntu0.1) ...
Removing libglib2.0-0:i386 (2.48.2-0ubuntu1) ...
Removing libgraphite2-3:i386 (1.3.10-0ubuntu0.16.04.1) ...
Removing libido3-0.1-0:amd64 (13.10.0+15.10.20151002-0ubuntu1) ...
Removing libnss3:i386 (2:3.28.4-0ubuntu0.16.04.3) ...
Removing libnspr4:i386 (2:4.13.1-0ubuntu0.16.04.1) ...
Removing libpixman-1-0:i386 (0.33.6-1) ...
Removing libxcb-render0:i386 (1.11.1-1ubuntu1) ...
Removing libxcb-shm0:i386 (1.11.1-1ubuntu1) ...
Removing libxtst6:i386 (2:1.2.2-1) ...
Processing triggers for libc-bin (2.23-0ubuntu7) ...
(Reading database ... 220487 files and directories currently installed.)
Removing thunderbird (1:52.1.1+build1-0ubuntu0.16.04.1) ...
Purging configuration files for thunderbird (1:52.1.1+build1-0ubuntu0.16.04.1) ...
                                        
Current status: 335 (-1) upgradable.
-e Removing old kernels...
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 335 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
                                        
-e Emptying every trashes...
-e Script Finished!
uetix@uetix-ok ~ $ ^C
uetix@uetix-ok ~ $

==================================================


semoga sukses.."tested work on linuxmint"



Tidak ada komentar:

Posting Komentar