A Complete Overview of sudo apt update Command in Linux

The ‘sudo apt update’ command is the most essential command in Linux to keep a system healthy and up-to-date. This command installs and downloads all the latest package information available for the packages currently installed on the system. This article comprehensively covers the sudo apt update command, its functionality, and its operations. Besides, the output of the command will be appropriately described.

Key Takeaways

  • Knowing how the sudo apt update command updates the package list in the Linux system.
  • Analyzing the output to realize what process the system is following to achieve the latest version of the packages.
  • Unleashing the way to set up automatic updates in the Linux system.


  • You must need to be a sudo/root user or need to have root privilege.
  • Your Linux system should have the correct package manager (for Ubuntu it’s ‘apt’).

Basics of sudo apt update Command

In Linux-based operating systems, particularly Ubuntu, the sudo apt update command essentially serves as an instruction to update the local package index. It downloads package details from all set sources to refresh the package cache. The package manager (in this case apt) needs to know which packages are available and where to find them to install software or packages on your system.

What is sudo?

The term sudo, which stands for ‘Superuser Do’, is a powerful utility, used in Linux and Unix-based operating systems. The ‘superusers’ or ‘root’ are the authorized users who get the elevated privilege to execute specific administrative commands and get the permissions to carry out any operations on the system. When you run the command sudo in your terminal, you temporarily get permission to perform tasks beyond your boundaries as a regular user. Before providing access, the command asks for a password to confirm your identity. The basic syntax of the sudo command is as follows:


To learn more read: The “sudo” Command in Linux [8 Practical Examples]

What is sudo apt?

Here the second term apt stands for Advanced Package Tool which is the library for package management systems used in Linux distributions. The keyword apt is used to call the apt repository which permits the users to install, update or remove packages from the repositories of software distributions. The sudo apt allows a root user to perform operations in the apt repository.

sudo apt install <package_name>

Here, in the place of <package_name>, you have to give the specific package name you want to install. This command downloads the latest version available for the mentioned package name.

What does the sudo apt update Command Do?

The sudo apt update command instructs the package manager to obtain the most recent package information from the software repositories to update the local package database. When you run sudo apt update the package manager searches for new updates or new software packages and then changes the existing local database of software packages.

Update Cache in Ubuntu Using APT

The ‘apt cache’ or ‘package cache’ both terminology refer to a local database that stores information about available software packages, including their names, versions, dependencies, and other metadata. Updating the ‘apt’ cache means refreshing the local database of available software packages and their metadata on your Linux system. This term indicates the process of updating packages using the sudo apt update command.

sudo apt update

After running the ‘sudo apt update’ command, your apt package cache will be up-to-date ensuring your system has the latest package information.

2 Practical Cases of Using the ‘sudo apt update’ Command in Linux

In this section, I’m going to make you familiar with the real scenarios of the ‘sudo apt update’ command and its functionality including its output breakdown. Here, you will get to know two scenarios to update your system both manual and automatic update setup.

Case 01: Manual Update Using the ‘sudo apt update’ Command

Here I’ll show how to run the command in the terminal in Ubuntu step by step. Then I’ll explain what the output of the command indicates including the description of each marked term.

Steps to Follow >

➊ Open the Ubuntu terminal.

➋ Write the following command to update your package manager.

sudo apt update

➌ Provide your root password and immediately you will start receiving the following statements.I've updated the package lists and database using sudo apt update command

The last few lines of sudo apt update commands' output includes Fetched information, Reading package lists, and Reading state information.From the image, you can notice the output of the command sudo apt update for updating packages that have been updated successively. Here you can see the package repository to update is http://bd.archieve.ubuntu.com/ubuntu which has been reached successfully.


I have explained the underlined data of the two above images:

  • Hit: This shows that the repository was successfully reached and that the package index for that repository was obtained.
  • Get: This shows that the repository’s package index or metadata are currently being retrieved.
  • Fetch: This line represents the overall amount of data fetched throughout the update process from all of the repositories as well as the time it took to finish.
  • Reading Package list … Done: This message denotes that the package management has completed reading the new package lists and that they have been updated correctly.
  • Building dependency tree . . . Done: To ensure that the installation and upgrades can be completed successfully, the package manager examines the package information and establishes the dependencies between packages.
  • Reading state information . . . Done: The package management presently checks the system’s installed packages to ensure that updates will be applied successfully and without issues.
  • All the packages are updated.: This text indicates that all the installed packages have been updated successfully according to the latest package index.

Case 02: Automatic Update Set-up Using the ‘sudo apt update’ Command

As it’s essential and rigorous to update your system packages regularly to have a secure and stable environment, it can be convenient for the users to set up an automatic update. Automatic updates in Ubuntu give you the privilege to get the process of downloading and installing software updates done without any manual intervention. If you want to automate the process of updating your installed packages, you can follow the steps stated below

Steps to Follow >

➊ Open the Ubuntu terminal or press CTRL+ALT+T.

➋ Run the following command to install the unattended-upgrades package.

sudo apt-get install unattended-upgrades

  • sudo: Provides the privilege to perform the administrative command.
  • apt-get: Allows you to interact with the apt package management system in Ubuntu.
  • install: This option in the apt-get command is for expressing your wish to install a package. When you choose the install option, you follow it with the package name you want to install.
  • unattended-upgrades: It automates the update process for the package you wish to install. It helps you to keep your system up-to-date without any manual intervention.

To automate the update process of installed packages, I've used sudo apt-get install unattended-upgrades command➌ Now, run the following command to edit the configuration file.

sudo nano /etc/apt/apt.conf.d/50unattended-upgrades

  • sudo: Gives you the root access.
  • nano: Opens /etc/apt/apt.conf.d/50unattended-upgrades to modify.
  • /etc/apt/apt.conf.d/50unattended-upgrades: Holds detailed setup choices for how to handle automatic upgrades without needing user intervention.

Opened 50unattended-upgrades file using nano command after sudo to configure the file Removed the double black slash from the updates line in the Allowed-Origins arguements.You can also uncategorize packages to which you don’t want auto update activated.In the Package-Blacklist argument list, any package name can be added to postpone thats' update. You can also edit the file to achieve multiple purposes. Such as:

  • If you want to get notifications in email, scroll down and find the 1st highlighted line. Now enter a valid email address within the quotation mark “ “ and remove the preceding double slashes.
  • To get a notification in case of any update gets wrong, uncomment the 2nd highlighted line and modify the attribute “on-change” to “only-on-error”
  • To remove unused kernel and new unused dependencies, just uncomment the 3rd and 4th highlighted lines.

To get notify about update, mail can be added on 1st line and to remove unused dependencies, 3rd and 4th lines value have to be true. If you want to auto-reboot your system after updating then replace “false” with “true” at the ‘6’ marked line and uncomment the line to execute. You can also modify the auto-reboot time at your convenience at the ‘8th’ highlighted line.To automatic reboot of your system and set the specific time for update and automatic reboot of your system, uncomment 7th and 8th line respectively.➍ Save the file and then exit by pressing CTRL+S and CTRL+X respectively after completing all the modifications you need.

➎ Finally, enable automatic updates by editing the “10auto-upgrades files as directed below. To access the file run the following command.

sudo nano /etc/apt/apt.conf.d/20aut-upgrades

  • sudo: Enables root privilege.
  • nano: Opens the file to edit
  • /etc/apt/apt.conf.d/20auto-upgrades: This file contains the configuration settings that deal with the automatic updates of packages.

Opened the 20auto-upgrades using sudo nano commandThis file contains only two lines that enable automatic updates and upgrades. The two lines are:

  1. APT : : Periodic : : Update-Package-Lists “1”;
  2. APT : : Periodic : : Unattended-Upgrade “1”;

Modified the 20auto-upgrades files two lines numerical value with 1 to automate the update processThe first line is for the auto-update of the package lists and the second line initiates the auto-upgrade of the packages. The numerical value quoted in both lines can be “1” or “0” where 1 enables auto update and upgrade and 0 disables that.


To conclude, for Ubuntu-based Linux systems, sudo apt update is crucial in maintaining a robust environment. It ensures updated installations and downloads for existing packages. I hope that the essay has helped you better to understand.

People Also Ask

How to use sudo apt update?
Firstly you have to have administrative permission. If you have that, you open a terminal and write down the command ‘sudo apt update.’ After that, It will ask you for a password to verify whether you do have all the required permissions or don’t. If the password becomes recognized, a list of repositories will start updating.
What is apt install?
apt install is a command for Debian-based Linux Distributions which installs software packages. You have to provide a specific package name you want to install. Then resolving dependencies, the apt install command downloads and installs the package on your system from the repository.
Does Linux update itself?
Although Linux does not update automatically, you can create a scheduler. Consequently, you can update your system automatically by utilizing your Linux OS.
Does Ubuntu have an automatic update?
Ubuntu provides a unique tool called unattended-upgrades to automatically download and install security patches for your system.

Related Articles

<< Go Back to Update Packages in Linux | Package Management in LinuxLearn Linux Basics

4.9/5 - (60 votes)
Auhona Islam

Auhona Islam is a dedicated professional with a background in Electronics and Communication Engineering (ECE) from Khulna University of Engineering & Technology. Graduating in 2023, Auhona is currently excelling in her role as a Linux content developer executive at SOFTEKO to provide a more straightforward route for Linux users. She aims to generate compelling materials for Linux users with her knowledge and skills. She holds her enthusiasm in the realm of Machine Learning (ML), Deep Learning (DL), and Artificial Intelligence (AI). Apart from these, she has a passion for playing instruments and singing. Read Full Bio

Leave a Comment