title: apt-get update, dist-upgrade, autoremove, autoclean in a single sudo command
body: <p>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:</p>
  
  <pre><code>sudo apt-get update &amp;&amp; sudo apt-get dist-upgrade &amp;&amp; sudo apt-get autoremove &amp;&amp; sudo apt-get autoclean
  </code></pre>
  
  <p>I'd like to shorten this down to one command (preferably without using a global alias).</p>
  
  <p><a href="https://github.com/l0b0/tilde/blob/d18a4d9be3cf17140bba242bca9f9923eaaf74bc/.bash_history#L1638" rel="noreferrer">Solution</a> based on <a href="https://stackoverflow.com/a/3316818/96588">@amra's answer</a> and <a href="https://askubuntu.com/a/171/10371">another tip</a>:</p>
  
  <pre><code>sudo sh -c 'apt-get update &amp;&amp; apt-get upgrade --yes &amp;&amp; if [ -f /var/run/reboot-required ]; then echo You should reboot; fi' 
  </code></pre>