How To Update Ubuntu With Command Line And Software Updater

By Mike Darrow
ubuntu software updater

Have you just get started using Ubuntu and are learning about the functions of this Debian-based Linux distribution? It might feel unfamiliar, especially when switching from Windows or Mac OS.

As a part of our Linux tutorial series for beginners, this tutorial gives you steps to update your system for security patches and bug fixes, as well as application upgrades. It also outlines the difference between the "update" and "upgrade" functions, along with a few other things you need to know about updates in Ubuntu.

Updating Ubuntu isn't as hard as you might think. It's quite straightforward and requires you to execute two commands or a few mouse clicks. You can either use the command line or Software Updater to update your Ubuntu system.

Let's go deeper into each method!

How To Update Your Ubuntu Via The Command Line

This method can be used on both the server and desktop versions of Ubuntu. If you use the desktop version, open the menu or press the Ctrl + Alt + T keystroke to launch the Terminal application.

In the Terminal window, type in and execute the following command:

sudo apt update && sudo apt upgrade -y

This command requires your Ubuntu account's password in order to proceed. However, you can't see the password on the screen while typing as a security purpose.

how to update and upgrade on Ubuntu

So just keep on typing your password and press the Enter key to execute the command.

Now let's explain the above command.

The command above is actually not a single command. It is a combination of the "update" and "upgrade" commands using the "&&" characters. This combined command runs in order, which means the second command only runs when the previous command has executed successfully.

The "-y" at the end of the command is to replace a press of the Enter key. The purpose is to say "YES" automatically when the command "apt upgrade" asks for your confirmation before installing updates.

If you don't want to use this combined command, run it as two separate commands. Firstly, it runs sudo apt update and then runs sudo apt upgrade when the first command ran successfully.

There is no difference between the two types, but the second one takes a bit longer because you need to wait for the first command to finish and then type in the second command to execute.

What Does The "sudo apt update" Command Do?

This command refreshes the list of available packages to check whether there are any new updates. When you execute the "sudo apt update" command, you will see lots of URLs in the output.

sudo apt update Ubuntu command line

It fetches the package information from the respective repositories, which are the URLs you see in the output.

If you don't run this command, the list of packages will not be refreshed and updated. Therefore, your Ubuntu system will not install any updates when you run the next command, which is "sudo apt upgrade". In a simpler term, you can consider "sudo apt update" as a "check for updates" function like on Windows.

When this command finishes, it will show you how many packages can be upgraded at the end of the command. You can use the "apt list --upgradable" command to see these packages.

apt list --upgradable command line

What Does The "sudo apt upgrade" Command Do?

It will compare the versions of installed packages on your Ubuntu system with the list of packages, which was refreshed and updated by the previous command. Then, it will show you the packages that have a newer version available.

sudo apt upgrade Ubuntu command line

To confirm that you want to upgrade the installed packages to the newer version, you can type "yes," "y," or simply press the Enter key.

install Ubuntu updates

In brief, the "sudo apt update" command checks for the availability of new package versions, while the "sudo apt upgrade" command actually installs the updates. The "update" term might be confusing because you might expect the "sudo apt update" command to install new software to update your Ubuntu system. However, that's not how it works.

How To Update Your Ubuntu Via Software Updater On Desktop Version

If you use the desktop version of Ubuntu, then the Software Updater is a more straightforward choice. Instead of typing commands, you can interact with the graphical user interface (GUI) by using your mouse to update your system, as you usually do on Windows or macOS.

From the menu of Ubuntu, search for "Software Updater". Then click on the application icon to run it.

Software Updater

Software Updater will check if there are updates available for your Ubuntu system. 

If there are updates available, it will show you details of updates and give you the option to install the updates or not.

Software Updater on Ubuntu

Besides, you can choose to install one or some specific packages instead of installing all available packages. To do so, simply click on "Details of updates" to expand the list and then uncheck the package you don't want to install.

Details of update on Ubuntu

If you want to install the updates, click on the Install Now button to proceed. You may need to enter the password of your Ubuntu account to install the updates.

Once you enter your password, Software Updater will start installing the updates.

In some cases, you may have to {reboot your Ubuntu system}*** for the installed updates to work properly. Software Updater will demand you to do so at the end of the update if required.

*** internal link - https://itsfoss.com/schedule-shutdown-ubuntu/

You can choose the "Remind Me Later" to reboot your system later if you don't want to do it straight away.

Tip: In case of getting any error while using the Software Updater, you should use the Terminal application to update your Ubuntu system. The reason is that you will see the actual error message in the last few lines of the output. It will help you to find out the root cause faster.

Things You Should Know About Updating Your Ubuntu System

We have explained and guided you about updating your Ubuntu system. However, there are a few things related to Ubuntu updates you should be aware of.

Clean Up Unnecessary Packages 

After installing updates, your Ubuntu system may have some unnecessary packages that are no longer required. By using this command: sudo apt autoremove, you can remove such packages and free up some storage space.

What the sudo apt-get autoremove command actually does?

Whenever you install an application by using apt-get, the Ubuntu system will also install the packages that the application depends on. When you remove the application, the packages will stay on your Ubuntu system.

sudo apt-get autoremove on Ubuntu

So the "sudo apt-get autoremove" command will remove those packages that were installed with applications and that are no longer used by anything else on the system.

Use Ubuntu Live Patching To Avoid Rebooting

If you are installing Linux kernel updates, you will need to reboot your system after the update. However, the downtime may be a serious problem when you operate an Ubuntu server that needs to run continuously.

The good news is that there is a solution. Since the release of the Linux 4.0 kernel, a feature called Live Patching allows you to patch and update Linux kernel packages while it is still running. In other words, you don't need to reboot your Ubuntu system.

Enable Live Patching on Ubuntu

So, if you operate an Ubuntu server where the uptime is a critical factor, you may want to enable the live patching feature.

Upgrade Ubuntu Packages Are Different From Ubuntu OS Upgrade

The update methods mentioned in this article keep your Ubuntu packages up to date. It does not include Ubuntu version updates, such as upgrading Ubuntu from 18.04 to 19.10. Ubuntu version upgrade involves updating the entire operating system core. This lengthy upgrade process needs to be done carefully and requires making a proper backup before starting.

Depending on how you configure your system, Ubuntu may notify you that a new release is available through the Software Updater tool, like this:

But if the Software Updater tool does not find an update, you can check for it manually. To do so, press the Alt + F2 keystroke and then execute this command: update-manager -c.

After that, the Software Updater tool checks for any update available from the Ubuntu's servers and notify you that a new version is available if one is.

Conclusion

We hope you like this tutorial on how to update the Ubuntu system, as well as a few things you should be aware of.

Is there something we missed? Share it with us to make this tutorial more useful. In case you have any questions, feel free to ask by leaving your comment below.

Related Posts

Leave a Comment