Summary

This post provides a brief overview on how to apply updates on Ubuntu.

To apply updates to systems with the Ubuntu OS. You need to use their package manager named apt or the Advanced Package Tool. This application provides a command line interface for handling packages for Ubuntu systems.

One thing that the maintainers warn about is it’s not suited for scripting. They recomend that users utilize the apt-get and apt-cache commands for that kind of thing.

I will show both the apt(1) and apt-get(8) commands. To just perform software updates on Ubuntu systems there are a few commands needed to perform updates.

One last thing to note is that after updating systems. There may be a requirement needed to reboot. One rule of thumb to make sure updates apply correctly is to do it anyway.

Applying Updates With apt(1) And apt-get(8)

This section goes through updating applications using the apt(1) and apt-get(8) commands. Note that commands need to use the sudo(1) command if not being run as root. This is true for all examples.

The command below will resynch the package index files from their sources.

apt(1)

apt update

apt-get(8)

apt-get update

This command is used to install the newest available versions of all packages installed on the system. This is from the sources it find in the /etc/apt/sources.list.

Note that new dependencies and packages may be installed with this sub-command. But, existing packages will not be removed.

apt(1)

apt upgrade

apt-get(8)

apt-get upgrade

The command below prevents user interaction. If no review of the packages are needed before install. Go for it.

apt(1)

apt upgrade -y

apt-get(8)

apt-get upgrade -y

There are times where packages that act as depenencies are installed. But, because they’re no longer needed for a specific application. They need to be removed. The autoremove flag can be used to remove all of them. They’re generally listed during the package upgrade process.

The -y flag can also be used to remove them to bypass the user prompt.

apt(1)

apt autoremove

apt-get(8)

apt-get autoremove

Always remember to reboot if it’s required. If problems occur as a result of not rebooting. Use a reboot as a troubleshooting step. You may even need to fix some dependencies.