Ubuntu Update Command
Linux Ubuntu is an open-source and free operating system that is based on Linux kernel and GNU userland. Ubuntu is popular for ease of use. It is famous on both servers and desktops. One could update Linux Ubuntu with the help of a terminal bash shell. If we are a new user and using Linux Ubuntu for some weeks or days, then we may be wondering how we can update our Ubuntu system for application upgrades, bug fixes, and security patches.
It is important to know about updating Ubuntu that not all the distributions manage the process of updating in a similar way. In fact, a few distributions are different distinctly down to the kind of the types of files they apply for package management.
Linux Ubuntu has become the most famous of every distribution of Linux. We should be capable of exactly telling what's the case from the procedure of updating any system. Ubuntu has a very user-friendly nature. Ubuntu applies two distinct tools to update the system.
These two tools are mentioned below:
GUI tool (Update Manager)
Nearly, the update manager is a 100% automatic tool. We will not need to check routinely that there is any update available using this tool. Rather we will know that the update is available as the Update Manager would open on our desktop as soon as an update relying on their type:
Command-line tool (apt-get)
Now, let's discuss the command line tools to update our system. A system, i.e., Ubuntu package management is known as apt. It is a very strong tool that can manage the packages of our systems completely using the command line.
There is a drawback of using the tool of the command line that to check if we have updates, then we need to manually run it.
This article is valid for the 18.04, 20.04, pr other versions of Ubuntu. Also, the method of the command line is valid for those distributions that are based on Ubuntu like elementary OS, Linux Lite, and Linux Mint.
First method: Updating Ubuntu with the Command line
We need to follow the following steps to update our Ubuntu system:
It will prompt for a password. We can enter the password of our account. We would not see any character over the screen when typing the password inside the terminal. Hence, keep on entering the password and press the Enter button. It will update all packages in our Ubuntu system.
Let's explain the command which is mentioned above. It is actually not one command, it is a consolidation of two commands. The symbol, i.e., && is a way for running more than one command in Ubuntu Linux in a way where the second command executes only if the first command successfully ran.
In the end, the "-y" automatically inputs "yes" at the time the "apt upgrade" command asks for our configuration before going to install updates.
Note: Also, we can separately use the above commands, one by one:
It will take time as we need to wait for a single command to complete and after that input the second command.
Important: Linux OS works using a package manager, unlike Windows. When we execute the updates, it will update every package that is installed by apt. It means that updating Ubuntu updates the Linux kernel, core operating system, and applications that are installed using the Software Center (if these are apt packages) or apt command.
Explanation of sudo apt update
The sudo apt update command will update the database (local) of existed packages. The database (local) would not be updated if we do not execute this command and our system will not understand when there are any newer package versions available. We will see several URLs in the results when we execute the command, i.e., "sudo apt update". The command will fetch the information of the package through the respective repository.
It will tell us how many packages could be upgraded. We can see the packages by executing a command which is mentioned below:
Explanation of sudo apt upgrade
The command, i.e., "sudo apt upgrade" will match the installed package versions with the database (local). It will collect each of them and after that, it would list the packages that contain a new version available. It will prompt if we wish to upgrade the packages (installed) to the new version at this point.
We can enter "y", "yes", or just hit the enter button for confirming the update installation. Hence, the bottom line is "sudo apt update" will check for the existence of new versions of the packages, while the "sudo apt upgrade" command installs the newer versions.
The word update may be confusing because we may expect the command, i.e., "apt update" for updating the computer by installing newer software, but that is not how it will work.
Second method: Updating Ubuntu using the GUI
As a desktop, if we are using Ubuntu, then we do not need to go to the command-line/terminal for updating the system. Still, we can use the terminal/command-line, but it is optional for us.
In a few cases, we might need to restart our Ubuntu computer for the updates (installed) to properly work. We would notify at the completion of the update if we need to reboot the system.
We can select to reboot later if we do not wish to restart our system straightway.
Note: We must use the "sudo apt update" command in the terminal when the software updater gives an error. Some of the last lines of the result will include the original error message. Then, we can find the Internet for this error and solve the problem.
Key points to remember when updating Ubuntu
We only learner how we can update our Ubuntu system. Also, we should understand some key points corresponding to Ubuntu updates if we are interested.
Cleaning up the system after the update
Our system might have a few unimportant packages that are no longer needed after the update. We can delete such types of packages and free up space by entering the command. This command is mentioned below:
Live patch the kernel within the Ubuntu Server to ignore restarting
We will need to reboot our system after an update in case of the updates of the Linux kernel. It can be an issue if we do not wish downtime for our server.
The feature, i.e., Live patching permits the Linux kernel patching while it's running. In some other terms, we do not need to restart our system.
We may wish for enabling live patching in Linux Ubuntu if we manage servers.
Version upgrades are distinct from package upgrades
The method of updates that were discussed here keeps our Ubuntu install updated and fresh. It does not cover version upgrades of the operating system (like upgrading the 16.04 version to the 18.04 version of Ubuntu).
The upgrades of Ubuntu versions are completely another thing. They include updating the entire core of the operating system. We will need to have appropriate backups before beginning this long process.