What is the difference between apt update and apt upgrade?

In Linux, you use the apt update and apt upgrade commands to get the latest version of the packages.


apt update

The apt update command doesn't download and upgrade any package, but it will provide information about which packages can be updated. In other words, this command can get the latest metadata (version, dependencies, etc.) of all the packages and is stored in the cache. Hence it is necessary to run this command to refresh the cache.

Here's how to utilize the apt update command.

Note: You must run these commands as a root user or by using the sudo prefix. Use the terminal attached at the end of this shot to try the commands discussed in this Answer.

root@educative:/# apt update
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:2 https://deb.nodesource.com/node_8.x xenial InRelease [4619 B]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [99.8 kB]
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [99.8 kB]
Get:5 https://deb.nodesource.com/node_8.x xenial/main amd64 Packages [1008 B]
Get:6 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [97.4 kB]
Get:7 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [2051 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [2560 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [16.4 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [1544 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [15.9 kB]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [984 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [26.2 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [10.9 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [12.7 kB]
Get:16 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [8820 B]
Fetched 7533 kB in 2s (3613 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
123 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@educative:/#
apt update example

To see the package list that can be upgraded, use the apt list --upgradable command.


apt upgrade

Once you get the latest version of metadata using the apt update command, you run the apt upgrade command to download and update the package to the newest version.

Here's how to use the apt upgrade command (you will be asked to enter Y/N to proceed, Y will continue, and N will exit the command).

root@educative:/# apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
libzstd1
The following packages will be upgraded:
apt apt-transport-https base-files bash binutils bsdutils bzip2
ca-certificates cpp-5 curl debconf dh-python distro-info-data
dpkg dpkg-dev e2fslibs e2fsprogs file g++-5 gcc-5 gcc-5-base git
git-man iproute2 krb5-locales libapparmor1 libapt-pkg5.0 libasan2
libatomic1 libblkid1 libbsd0 libbz2-1.0 libc-bin libc-dev-bin
libc6 libc6-dev libcc1-0 libcilkrts5 libcomerr2 libcurl3-gnutls
libdb5.3 libdns-export162 libdpkg-perl libexpat1 libfdisk1
libgcc-5-dev libgcrypt20 libgnutls30 libgomp1 libgssapi-krb5-2
libhogweed4 libisc-export160 libitm1 libk5crypto3 libkmod2
libkrb5-3 libkrb5support0 libldap-2.4-2 liblsan0 libmagic1
libmount1 libmpx0 libnettle6 libp11-kit0 libpam-modules
libpam-modules-bin libpam-runtime libpam0g libperl5.22 libprocps4
libpython2.7-minimal libpython2.7-stdlib libpython3.5
libpython3.5-minimal libpython3.5-stdlib libquadmath0 libsasl2-2
libsasl2-modules libsasl2-modules-db libseccomp2 libsmartcols1
libsqlite3-0 libss2 libssl-dev libssl-doc libssl1.0.0
libstdc++-5-dev libstdc++6 libsystemd0 libtsan0 libubsan0
libudev1 libuuid1 libx11-6 libx11-data linux-libc-dev login mount
multiarch-support nodejs openssh-client openssl passwd patch perl
perl-base perl-modules-5.22 procps python2.7 python2.7-minimal
python3.5 python3.5-minimal rsync systemd systemd-sysv tar
ubuntu-keyring util-linux vim vim-common vim-runtime zlib1g
zlib1g-dev
123 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 105 MB of archives.
After this operation, 6889 kB of additional disk space will be used.
Do you want to continue? [Y/n]
apt upgrade example

Note: apt upgrade will update all the upgradeable packages. To update a specific package, use the command apt install [package-name].


Terminal 1
Terminal
Loading...

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved