What Does “sudo apt-get update” do? – POFTUT

What Does “sudo apt-get update” do?


We have examined the apt-get  and its commands in a detailed manner previously. apt-get  is used to manage installed packages in a Linux distribution like Ubuntu, Debian, Mint, Kali, etc. Here we will look simply sudo apt-get update  and related commands to update a deb based Linux distribution. For detailed tutorials look following.

How To Apt-Get Update, Upgrade, Dist-Upgrade, Full-Upgrade and Their Similarities and Diffirencies

How To Install Updates In Ubuntu, Debian, Mint, Kali

Get Root Privileges with “sudo”

Actually this is not separate command or step. It is used with apt-get update but I wanted to explain in detail. apt-get  command requires root-level privileges to change package database. This is security enforcement for the Linux systems. In order to write changes to the apt database, we need to be root or root-level user or gain privilege with sudo command. For example, the following command will run as root and provide root user information.

$ sudo whoami
Get Root Privileges with "sudo"
Get Root Privileges with “sudo”

Update Package Information About Repositories

Now we will examine the real command sudo apt-get update . This command will update the deb or apt-get package database. The newer version information will be written into this database. But keep in mind that packages will not be upgraded as it is separate or the next step. This is useful if we want to upgrade some specific packages and do not upgrade others.

Update information will be fetched from configured repositories which are us repositories in this example as we can see. This will only download packages metadata that have updates and do not download whole packages.

$ sudo apt-get update
Update Package Information About Repositories
Update Package Information About Repositories

Upgrade Packages

The last step is upgrading the packages. We have already the information about updates and this step will trigger the upgrade process the real packages will be downloaded, installed and configured accordingly. We will use sudo apt-get upgrade  which requires root privileges too.

$ sudo apt-get upgrade
Upgrade Packages
Upgrade Packages

LEARN MORE  How To List Available Updates and Updateable Packages with Apt, Apt-Get, Aptitude Commands?

Leave a Comment