Created
April 23, 2024 12:27
-
-
Save scottstensland/14a0b212f8f151fb154c236f07ff71ee to your computer and use it in GitHub Desktop.
one liner to update installed packages on a Debian based linux box
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# one liner to update installed packages on a Debian based linux box like my laptop | |
# | |
# on debian based linux put below one liner into your ~/.bashrc | |
# to define an alias I use to update installed packages | |
# then just type in doit to perfom updates | |
alias doit='echo "sudo service packagekit restart"; sudo service packagekit restart; echo; kill $( ps -eafww|grep update-manager|grep -v grep | grep update-manager | tr -s " " |cut -d" " -f2 ) > /dev/null 2>&1; echo "sudo ucf --purge /boot/grub/menu.lst" ; sudo ucf --purge /boot/grub/menu.lst ; echo; echo "DEBIAN_FRONTEND=noninteractive sudo apt-get update" ; DEBIAN_FRONTEND=noninteractive sudo apt-get update ; echo; echo "DEBIAN_FRONTEND=noninteractive sudo apt-get --fix-broken install -y " ; DEBIAN_FRONTEND=noninteractive sudo apt-get --fix-broken install -y ; echo; echo "DEBIAN_FRONTEND=noninteractive sudo apt-get -f install -y " ; DEBIAN_FRONTEND=noninteractive sudo apt-get -f install -y ; echo; echo "sudo env DEBIAN_FRONTEND=noninteractive UCF_FORCE_CONFFNEW=YES apt-get -o Dpkg::Options::="--force-confnew" -yy dist-upgrade -yq" ; sudo env DEBIAN_FRONTEND=noninteractive UCF_FORCE_CONFFNEW=YES apt-get -o Dpkg::Options::="--force-confnew" -yy dist-upgrade -yq ; echo; echo " df -h" ; df -h ; echo; echo "DEBIAN_FRONTEND=noninteractive sudo apt-get autoremove -yq " ; DEBIAN_FRONTEND=noninteractive sudo apt-get autoremove -yq ; echo; echo "sudo apt-get autoclean -y" ; sudo apt-get autoclean -y ;echo; [ -f /var/run/reboot-required ] && echo && echo " [ -f /var/run/reboot-required ] ; sudo reboot now # if it reached this far machine wants a reboot " && echo # if it reached this far machine wants a reboot ' | |
# above alias is exploded below for ease of seeing each command | |
# notice it echos back whether it determines if given machine wants a reboot after doing all updates | |
# ............. top of commands same as above alias ............. | |
echo "sudo service packagekit restart"; | |
sudo service packagekit restart; | |
echo; | |
kill $( ps -eafww|grep update-manager|grep -v grep | grep update-manager | tr -s " " |cut -d" " -f2 ) > /dev/null 2>&1; | |
echo "sudo ucf --purge /boot/grub/menu.lst"; | |
sudo ucf --purge /boot/grub/menu.lst; | |
echo; echo "DEBIAN_FRONTEND=noninteractive sudo apt-get update"; | |
DEBIAN_FRONTEND=noninteractive sudo apt-get update; | |
echo; | |
echo "DEBIAN_FRONTEND=noninteractive sudo apt-get --fix-broken install -y " ; | |
DEBIAN_FRONTEND=noninteractive sudo apt-get --fix-broken install -y ; | |
echo; echo "DEBIAN_FRONTEND=noninteractive sudo apt-get -f install -y " ; | |
DEBIAN_FRONTEND=noninteractive sudo apt-get -f install -y ; | |
echo; | |
echo "sudo env DEBIAN_FRONTEND=noninteractive UCF_FORCE_CONFFNEW=YES apt-get -o Dpkg::Options::="--force-confnew" -yy dist-upgrade -yq" ; | |
sudo env DEBIAN_FRONTEND=noninteractive UCF_FORCE_CONFFNEW=YES apt-get -o Dpkg::Options::="--force-confnew" -yy dist-upgrade -yq ; | |
echo; | |
echo " df -h" ; | |
df -h ; | |
echo; | |
echo "DEBIAN_FRONTEND=noninteractive sudo apt-get autoremove -yq " ; | |
DEBIAN_FRONTEND=noninteractive sudo apt-get autoremove -yq ; | |
echo; | |
echo "sudo apt-get autoclean -y" ; | |
sudo apt-get autoclean -y ; | |
echo; | |
[ -f /var/run/reboot-required ] && \ | |
echo && \ | |
echo " [ -f /var/run/reboot-required ] ; sudo reboot now # if it reached this far machine wants a reboot " && \ | |
echo # if it reached this far machine wants a reboot | |
# ............. bottom of commands ............. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment