Today’s article will show how to update and upgrade Ubuntu from the terminal. Of course, this will work on any system that uses apt, including Debian, Lubuntu, Linux Mint, etc… You can always upgrade when the GUI tells you to, but you can do it manually on your own time.
Once in a while, I come across someone who refuses to upgrade. This is a bad idea. Upgrades include things like security upgrades and they’re pretty much mandatory. It’s Linux, so you don’t “have to”, but it makes you a bad netizen because those security upgrades may very well mean your computer is being used as a spam relay or, worse, a part of a botnet.
So, please, upgrade your Ubuntu systems – and, really, all Linux boxes should get regular upgrades. I can’t emphasize this enough! Upgrade your system – if not for you then for the rest of us who have to deal with enough internet hostility. Malware exists for Linux, as does exploits for Linux and the software you have installed. Even if you don’t care about your own experiences, care about the rest of the people on the ‘net. Thanks!
For this article, we’ll be using apt. Apt is apt-get in disguise, but not quite the same. If you’re scripting you use apt-get, because it’s more stable. When you’re running commands yourself, use apt because it’s faster/easier.
This article should be pretty quick and easy.
Obviously, this article requires an open terminal. You can open one with your keyboard – just press CTRL + ALT + T and your default terminal should open.
Once you have your terminal open, we’ll go ahead and update the database (the cache) to see if any upgrades are available. To do that, you run:
sudo apt update
It’ll tell you if upgrades are available and give you some more information – such as telling you how to see which application upgrades are available. In this case, we’re just going to upgrade everything. Like so:
sudo apt upgrade
That is sometimes interactive. It will want you to agree manually to the upgrades. You can just skip all that by adding a -y
flag. Even better, you can now string both commands together and save some time monitoring the terminal. That command, and I use this pretty much exclusively by way of alias, is:
sudo apt update && sudo apt upgrade -y
The &&
means that the next command will only run if the first has been completed successfully. You can even add autoremove to this string of commands and keep things a little cleaner automatically.
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
The autoremove
will “remove packages that were automatically
installed to satisfy dependencies for other packages and are now no
longer needed as dependencies changed or the package(s) needing
them were removed in the meantime.” You might as well include it, as it’s pretty harmless and will save you some disk space.
Finally, there’s full-upgrade
which is quite similar to the old apt-get dist-upgrade
, in that it will upgrade you to a new release if both a new release is available and your settings are to upgrade to new releases (instead of staying on a LTS branch, for example). You’ll find that full-upgrade
is also capable of deleting unneeded files all on its own.
To use full-upgrade, you’d still run the update first and then run the command. You can also pack them together, like so:
sudo apt update && sudo apt full-upgrade -y
And there you have it. That’s about all you really need to know about upgrading Ubuntu from the terminal. It’s not hard, so just do it. Yeah, once in a blue moon it breaks something. That’s usually easily fixed and the risk is worth the benefits – to you and the rest of the internet.
I can’t emphasize it enough – do your upgrades regularly. Now you know how to upgrade Ubuntu from the terminal, which is something I naturally do out of habit. I actually have it aliased to the ‘update’ command and it takes care of all that for me. I can’t remember the last time it broke anything – but it has to have been multiple years ago. Breakage isn’t a real risk, as things are usually heavily tested.
Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.
Today we'll cover one way to enable or disable your network interface in the Linux…
Today's exercise is a nice and simple exercise where we check your NIC speed in…
Have you ever wanted to easily monitor your wireless connection? Well, now you can learn…
I think I've covered this before with the ls command but this time we'll count…
Today we'll be learning about a basic Linux command that's known as 'uname' and it…
If you've used hardinfo in the past, it may interest you to know that hardinfo…