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