Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apt-get update, dist-upgrade, autoremove, autoclean in a single sudo command

Tags:

ubuntu

apt-get

My usual command for keeping the machine up to date is rather verbose, and it can result in more than one password prompt if any command takes a long time:

sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove && sudo apt-get autoclean

I'd like to shorten this down to one command (preferably without using a global alias).

Solution based on @amra's answer and another tip:

sudo sh -c 'apt-get update && apt-get upgrade --yes && if [ -f /var/run/reboot-required ]; then echo You should reboot; fi' 
like image 209
l0b0 Avatar asked Jul 23 '10 08:07

l0b0


1 Answers

Try

sudo sh -c "apt-get -y update;apt-get -y dist-upgrade;apt-get -y autoremove;apt-get -y autoclean"
like image 188
amra Avatar answered Oct 24 '22 03:10

amra