Ad

Apt-get Update, Dist-upgrade, Autoremove, Autoclean In A Single Sudo Command

- 1 answer

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' 
Ad

Answer

Try

sudo sh -c "apt-get -y update;apt-get -y dist-upgrade;apt-get -y autoremove;apt-get -y autoclean"
Ad
source: stackoverflow.com
Ad