Skip to main content
0 reactions

How to Update the Package List on Ubuntu (sudo apt update)

Featured card for How to Update the Package List on Ubuntu. A terminal window ticks off sudo apt update, package lists refreshed, fetched 4463 kB and 32 packages that can be upgraded.
Refresh the package list on Ubuntu with sudo apt update.

Before you install or upgrade software on Ubuntu, refresh its package list. One command does it: sudo apt update.

Ubuntu installs software from repositories, online collections of packages, and keeps a list of what each one offers. apt update downloads a fresh copy of those lists, so your next install or upgrade gets the newest versions. It doesn’t install or upgrade anything itself.

Every command and output on this page is real, from Ubuntu 26.04 LTS.

Syntax

SyntaxBash
sudo apt update
  • sudo: runs the command as the administrator. The package lists are system files, so updating them needs it.
  • apt: Ubuntu’s package manager, the tool that installs, upgrades and removes software.
  • update: downloads package information from all the sources your Ubuntu uses.

The parts are described in apt’s manual page (opens in a new tab) for Ubuntu 26.04.

Prerequisites

  • A user account that can run commands with sudo.

Step 1: Update the Package List on Ubuntu

Open a terminal and run:

Ubuntu TerminalBash
sudo apt update

If Ubuntu asks for your password, type it and press Enter: nothing appears while you type.

OutputPlain text
Hit:1 http://archive.ubuntu.com/ubuntu resolute InRelease
Get:2 http://security.ubuntu.com/ubuntu resolute-security InRelease [137 kB]
Get:3 http://archive.ubuntu.com/ubuntu resolute-updates InRelease [137 kB]
Get:4 https://apt.postgresql.org/pub/repos/apt resolute-pgdg InRelease [189 kB]
Get:5 http://archive.ubuntu.com/ubuntu resolute-backports InRelease [137 kB]
Get:6 http://archive.ubuntu.com/ubuntu resolute-updates/main arm64 Packages [936 kB]
Get:7 https://apt.postgresql.org/pub/repos/apt resolute-pgdg/main arm64 Packages [1178 kB]
Get:8 http://security.ubuntu.com/ubuntu resolute-security/main arm64 Packages [762 kB]
Get:9 http://archive.ubuntu.com/ubuntu resolute-updates/main arm64 Components [108 kB]
Get:10 http://archive.ubuntu.com/ubuntu resolute-updates/universe arm64 Packages [381 kB]
Get:11 http://archive.ubuntu.com/ubuntu resolute-updates/universe arm64 Components [178 kB]
Get:12 http://archive.ubuntu.com/ubuntu resolute-backports/universe arm64 Components [1056 B]
Get:13 http://security.ubuntu.com/ubuntu resolute-security/main arm64 Components [44.9 kB]
Get:14 http://security.ubuntu.com/ubuntu resolute-security/universe arm64 Packages [211 kB]
Get:15 http://security.ubuntu.com/ubuntu resolute-security/universe arm64 Components [62.7 kB]
Fetched 4463 kB in 5s (854 kB/s)
32 packages can be upgraded. Run 'apt list --upgradable' to see them.

Each Hit or Get line is a package list from one of the sources your Ubuntu uses. Get lines are lists apt downloaded, with their size in brackets, and Fetched adds them up. Your sources will differ: this computer also uses the PostgreSQL repository.

The last line counts the installed packages that have newer versions waiting. apt update only finds them. To install them, upgrade your packages, as How to Upgrade Packages on Ubuntu shows.

Common Mistakes

MistakeWhat happensDo this instead
Running apt update without sudoError: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied), and the list isn’t updatedRun sudo apt update.
Expecting apt update to install the updatesNothing is upgraded, and the last line still counts the packages waitingUpgrade them with sudo apt upgrade.

FAQ

What’s the difference between apt update and apt upgrade?

apt update refreshes the list of available packages. apt upgrade installs the newer versions that list shows. Run them in that order.

When should I run apt update?

Before you install or upgrade software, so apt works from the newest list. Ubuntu’s server documentation asks for the same.

Should I use apt or apt-get?

Use apt when you type commands yourself. Its manual describes it as the tool for people at a terminal, with defaults better suited to interactive use than the more specialised apt-get.

Conclusion

sudo apt update refreshes Ubuntu’s package lists and tells you how many installed packages can be upgraded. Run it before every install or upgrade, as How to Install PostgreSQL 19 on Ubuntu does in its first step.

Additional Resources

0 comments