What Does “sudo apt-get update” Do?

Linux distributions like Ubuntu, Debian, Mint, Kali, etc. use the deb packages and apt-get for package management. One of the most used package management commands is “sudo apt-get update”. If you are using a newer version the “sudo apt update” command is used. But what does the “sudo apt-get update” comman do?

What Does “sudo apt-get update” Do?

The apt-get command is used to manage packages by installing, updating and removing them. In order to install or update a package the package information is provided via repositories. A repository is a online or internet based package repo which contains package files and meta data. Before updating or upgrading packages the package information should be fetched from the repository. the “sudo apt-get update” command simply get this package information from the repository.

The package management and apt-get requires root privileges. So this means the “apt-get update” command can be only run as a root user or a user with sudoer which can be provided with the sudo command. Simply the sudo command give the ability to run “apt-get update” command to run as a regular user by elevating privileges.

Compare “sudo apt-get update” vs “sudo apt-get upgrade” vs “sudo apt-get dist-upgrade”

Generally, the “sudo apt-get update” command is compared with the “sudo apt-get upgrade” and “sudo apt-get dist-upgrade” commands. Even it is confused with them. Let’s compare these commands with each other for different aspects.

Operationsudo apt-get updatesudo apt-get upgradesudo apt-get dist-upgrade
Get Package Infox
Download Packagexx
Upgrade Package x
Upgrade Package Automaticallyx

Compare “sudo apt-get update” vs “sudo apt update” Commands

You may notice that the “sudo apt-get update” and “sudo apt update” commands are very similar and used interchangeably. Actually, they do the same thing simply update the package and repository information. The “sudo apt update” is more recent than “sudo apt-get update”. So basically following commands to the same thing.

sudo apt-get update

is same with the following

sudo apt update

Update and Upgrade Packages In a Single Command

Actually, the packages in a deb based system like Ubuntu, Debian, Mint, or Kali can be updated and upgrade in a single command or single line easily. The && double ampersand operator is used to run “sudo apt-get update” and “sudo apt-get dist-upgrade” like below.

sudo apt-get update && sudo apt-get dist-upgrade
Update and Upgrade Packages In a Single Command

Leave a Comment