Ubuntu: How to install updates via command line?


When I log into my web server via SSH I see the information:

88 packages can be updated.  80 updates are security updates  

I tried apt-get update then apt-get upgrade but each time I log in I still see the message about updates. How do I install them?


Try this:

sudo apt-get update        # Fetches the list of available updates  sudo apt-get upgrade       # Strictly upgrades the current packages  sudo apt-get dist-upgrade  # Installs updates (new ones)  


This is normal behavior.

The message you see on login has been appended to the server status 'Message-Of-The-Day', which is only updated each calendar day (or on server boot / startup). Have a look at the contents, using

cat /etc/motd  

Still seeing the same updates available, after running

sudo apt-get update && sudo apt-get upgrade  

is to be expected. If you then re-run this command you will only be prompted for any further updates if even further (newer) updates have been released.


Execute all the commands by typing sudo once:

sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'  


sudo -s -- <<EOF  apt-get update  apt-get upgrade -y  apt-get dist-upgrade -y  apt-get autoremove -y  apt-get autoclean -y  EOF  


Once your log into your server, run the command below.

sudo apt-get upgrade  

It should do the trick. Maybe you just need to restart your server.


In my case, I had an incorrect or not accessible URL in /etc/apt/sources.list. After removing this URL, I was able to update all packages successfully.


sudo vi /etc/apt/sources.list  sudo apt-get update && sudo apt-get upgrade  


My (really late, I like necromancer badges :-) ) solution:

  1. Install wajig (once):

    sudo apt-get install wajig   
  2. When you want to update/upgrade fully your system

    wajig dailyupgrade  

    (it will ask for password if needed, and do all the update, upgrade, dist-upgrade, and autoremove steps for you).


You may also need to do this -

sudo touch /etc/motd.tail  

From - Ubuntu tells me I have packages to upgrade when I don't

It worked for me on 14.04


If you run apt-get update again after apt-get upgrade has been concluded, those messages at ssh login should go away.


You can try all of these:

sudo apt-get install software-center (gets the software center)  sudo apt-get update  sudo apt-get upgrade  sudo apt-get dist-upgrade

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »