Simulate upgrade with apt-get upgrade --dry-run
In the previous step, you saw which packages have updates available. Before actually performing an upgrade, it's a good practice to simulate the process. This allows you to see exactly what will happen without making any changes to your system.
We'll use the apt-get upgrade
command with the --dry-run
option. Note that apt-get
is an older command-line tool for APT, but it's still widely used and works alongside the newer apt
command.
In your terminal, type the following command and press Enter:
sudo apt-get upgrade --dry-run
Let's break down this command:
sudo
: Again, we need administrative privileges to simulate an upgrade.
apt-get
: The command-line tool for managing packages.
upgrade
: This tells apt-get
that you want to upgrade installed packages to their latest versions.
--dry-run
: This is the key option here. It tells apt-get
to go through the process of determining what would be upgraded, installed, or removed, but without actually performing any of those actions.
The output will show you a summary of the actions that would be taken if you ran the command without --dry-run
.
You might see output similar to this:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
bind9-dnsutils bind9-host bind9-libs ...
...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
This output lists the packages that would be upgraded. It also tells you how many packages would be upgraded, newly installed (as dependencies), removed, or kept back (not upgraded due to dependency issues).
Using --dry-run
is a safe way to preview the effects of an upgrade before committing to it.
Click Continue to complete this lab.