Jun 11, 2024 5 min read

How to Update Packages via Ubuntu Command Line

Update Packages via Ubuntu Command Line with our step-by-step tutorial. Packages enhance software applications by grouping files and functions.

Update Packages via Ubuntu Command Line
Update Packages via Ubuntu Command Line
Table of Contents


Before we begin talking about how to update packages via Ubuntu Command Line, let's briefly understand – What are Packages?

Packages are collections of related files and functionalities used to extend the capabilities of software applications. In programming, a package serves as a way to organize code modules, making it easier to manage and reuse code. These modules can include functions, classes, variables, and other resources that can be imported and utilized in different programs.

By using packages, developers can save time by leveraging existing code solutions rather than reinventing the wheel. Packages play a crucial role in modern software development by promoting code reusability, modularity, and maintainability. They help streamline the development process and contribute to creating efficient, scalable, and robust.

In this tutorial, you will update packages via Ubuntu Command Line. We will also address a few FAQs on how to update packages via Ubuntu Command Line.

Method 1:Via Terminal

Press Ctrl+Alt+T to open the terminal or click the terminal icon in the shell to access it on the Ubuntu desktop.

The command that follows in the terminal type

sudo apt update

Once you enter the command mentioned above, your password will be requested. In the terminal, type the password. When you type your password, nothing will appear on the terminal. Press enter after entering the password.

Contrary to popular assumption, this command does not cause your system to update. Rather, it updates the repositories on Ubuntu.  Consequently, the repositories are checked by your system. It determines whether the installed program has any updated versions available. It will update the available information about the existing packages and their versions, but it won't immediately update your installed packages. For this reason, Ubuntu displays the number of packages that can be updated after this command has completed.

The command executes, and Ubuntu displays a list of packages that can be updated, as seen in the image above. Enter the following command to see these packages.

apt list --upgradable

You have the option to update a specific package or every updateable package on your Ubuntu system. In the terminal, simply enter the following command to update every package you have.

sudo apt upgrade

Ubuntu will prompt you for your password after you type the above command one more. Enter the password as before and press Enter.

Ubuntu will ask for your confirmation and show you the amount required to update these packages after 2 or 3 seconds. Type y into the terminal and hit Enter to continue. Ubuntu will begin downloading and updating your packages as soon as you complete this.

Every package that needs to be updated will be downloaded and updated by this command. Here's a little expert advice to help you with this updating task. Alternatively, you can enter the following command in place of these two commands.

sudo apt update && sudo apt upgrade -y

We can combine the two commands into a single command because they must be executed consecutively. The two commands are combined by the && in between. The first command that ran before the && sign is now executed. The remainder of the command follows the && and is executed after the first command has finished. When Ubuntu asks if you want to install the upgrades or not, the -y at the end will save you one keystroke.  This command should be used periodically to keep your system updated.

Method 2: Update using Package Updater:

Navigate to the menu and type "Software Updater" into the search bar. Run it now.

It will determine which packages on your system are updatable.

It will give you the choice to install the updates if there are any such packages.

Select "Install Now". It'll inquire about your password. After entering your password, click "Authenticate".

Ubuntu will begin downloading and installing the updates after you authenticate.

You may occasionally be prompted to restart your computer after the updates. This is necessary for the installed and updated packages to function correctly and take full effect.

The majority of the time, certain packages become useless for the user after an update. You have the option to remove them, which will keep your system organized and free up space—both of which are always desirable. Enter the following command in the terminal to accomplish this.

sudo apt autoremove

This guide applies to all Ubuntu versions as well as other Linux distributions that are based on Ubuntu, such as Linux Mint, Linux Lite, and so forth.

FAQs to Update Packages via Ubuntu Command Line

What should I do if the 'apt update' command fails?

If the 'apt update' command fails, ensure your network connection is stable and that your package repositories are correctly configured.

Can I automate package updates on Ubuntu?

Yes, you can set up automatic updates on Ubuntu by configuring the 'unattended-upgrades' package.

Is it necessary to restart Ubuntu after updating packages?

In most cases, it is not required to restart Ubuntu after updating packages unless you've updated the kernel or critical system components.

Is it necessary to update packages regularly on Ubuntu?

Yes, updating packages regularly on Ubuntu is essential to ensure that your system remains secure, stable, and up to date with the latest features and bug fixes.

Can I schedule automatic updates for packages on Ubuntu?

Yes, you can set up automatic updates on Ubuntu to ensure that your system regularly checks for and installs available package updates without manual intervention.

Will updating packages affect my system's stability on Ubuntu?

Updating packages on Ubuntu is generally safe and helps maintain system stability by applying security patches, bug fixes, and performance improvements provided by software developers.

Are there risks involved in updating packages on Ubuntu?

While updating packages on Ubuntu is generally safe, there could be rare instances where compatibility issues or conflicts with existing software may arise. It is advisable to back up critical data before performing updates.


We hope this tutorial helped you understand how to update packages via Ubuntu Command Line.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.