Network components

Update Linux from the command line

0

One common task on a desktop computer is applying updates. Software updates keep your system on the latest patches, ensuring that everything runs smoothly.

If you run a graphical desktop like KDE or Xfce or GNOME, you probably use the built-in tool to apply updates. But you can also install updates from the command line. This is very useful for servers, or for some other Linux system that runs in text mode. Here’s how to do it:

List the updates to apply

Fedora Linux uses the dnf package manager. Although the latest Fedora actually uses dnf5, the system provides an alias as dnf so you can run it with either command name.

The general usage of dnf is:

dnf5 subcommand [options..] [arguments..]

To list the updates that are available to install on your system, use the list subcommand, which can list the packages that are already installed or the packages that can be installed. To list the updates, use --upgrades as the option to the list subcommand:

$ sudo dnf list --upgrades

An alias to --upgrades is --updates, which I find easier to remember because I want to update the packages on my system.

When I ran the command on my system, I saw that there were four updates available to install:

$ sudo dnf list --updates
Updating and loading repositories:
Repositories loaded.
Available upgrades
libcupsfilters.x86_64   1:2.1.1-1.fc41 updates
llvm-libs.x86_64        19.1.7-3.fc41  updates
python3-boto3.noarch    1.37.7-1.fc41  updates
python3-botocore.noarch 1.37.7-1.fc41  updates

Install the updates

To install the updates on your system, use the update subcommand Since I only have four available available to update, the dnf command first lists the packages, then asks if I really want to proceed with the update:

$ sudo dnf update
Updating and loading repositories:
Repositories loaded.
Package                       Arch   Version                 Repositor      Size
Upgrading:
 libcupsfilters               x86_64 1:2.1.1-1.fc41          updates     1.5 MiB
   replacing libcupsfilters   x86_64 1:2.1.0-6.fc41          <unknown>   1.5 MiB
 llvm-libs                    x86_64 19.1.7-3.fc41           updates   124.5 MiB
   replacing llvm-libs        x86_64 19.1.7-2.fc41           <unknown> 124.5 MiB
 python3-boto3                noarch 1.37.7-1.fc41           updates     2.1 MiB
   replacing python3-boto3    noarch 1.37.5-1.fc41           <unknown>   2.1 MiB
 python3-botocore             noarch 1.37.7-1.fc41           updates   100.1 MiB
   replacing python3-botocore noarch 1.37.5-1.fc41           <unknown>  99.8 MiB

Transaction Summary:
 Upgrading:          4 packages
 Replacing:          4 packages

Total size of inbound packages is 40 MiB. Need to download 40 MiB.
After this operation, 361 KiB extra will be used (install 228 MiB, remove 228 MiB).
Is this ok [y/N]: 

If you’re ready to proceed, press y on your keyboard. You’ll see dnf download all the updates, then install them:

...
Is this ok [y/N]: y
[1/4] python3-boto3-0:1.37.7-1.fc41.noa 100% | 629.5 KiB/s | 419.9 KiB |  00m01s
[2/4] libcupsfilters-1:2.1.1-1.fc41.x86 100% | 762.1 KiB/s | 605.9 KiB |  00m01s
[3/4] python3-botocore-0:1.37.7-1.fc41. 100% |   2.1 MiB/s |   7.8 MiB |  00m04s
[4/4] llvm-libs-0:19.1.7-3.fc41.x86_64  100% |   3.5 MiB/s |  31.5 MiB |  00m09s
--------------------------------------------------------------------------------
[4/4] Total                             100% |   4.2 MiB/s |  40.3 MiB |  00m09s
Running transaction
[ 1/10] Verify package files            100% |  13.0   B/s |   4.0   B |  00m00s
[ 2/10] Prepare transaction             100% |  16.0   B/s |   8.0   B |  00m00s
[ 3/10] Upgrading python3-botocore-0:1. 100% |  45.1 MiB/s | 100.6 MiB |  00m02s
[ 4/10] Upgrading python3-boto3-0:1.37. 100% |  22.6 MiB/s |   2.1 MiB |  00m00s
[ 5/10] Upgrading llvm-libs-0:19.1.7-3. 100% | 152.2 MiB/s | 124.5 MiB |  00m01s
[ 6/10] Upgrading libcupsfilters-1:2.1. 100% |  43.2 MiB/s |   1.6 MiB |  00m00s
[ 7/10] Removing python3-boto3-0:1.37.5 100% |  22.8 KiB/s | 187.0   B |  00m00s
[ 8/10] Removing python3-botocore-0:1.3 100% | 154.8 KiB/s |   2.8 KiB |  00m00s
[ 9/10] Removing llvm-libs-0:19.1.7-2.f 100% |   2.9 KiB/s |  18.0   B |  00m00s
[10/10] Removing libcupsfilters-1:2.1.0 100% |  42.0   B/s |  39.0   B |  00m01s
Complete!

To skip this confirmation when you install updates, add the -y or --assumeyes option:

$ sudo dnf update --assumeyes

Learn more

The dnf5-list(8) manual page has full documentation about the list subcommand, including the --installed option to list only the installed packages, or --available to list only the packages that are available to install. For more information on the install subcommand, see the dnf5-install(8) manual page. The update subcommand is an alias of upgrade; you can find full documentation in the dnf5-upgrade(8) manual page.

Leave a Reply