How to Update Debian Linux

Learn to update Debian Linux system in one single command. Yes, it's that easy and straightforward.

Abhishek Prakash
Abhishek Prakash

Table of Contents

If you want to update Debian Linux system, here's what you need to do.

Update the local package database cache with:

sudo apt update

And then update all the installed software, kernel and other system components at once using:

sudo apt upgrade

Press Y key when you are asked to confirm.

Combine the above two commands

Alternatively, you can combine the above two commands with the help && operator. You can also provide the conformation automatically using -y:

sudo apt update && sudo apt upgrade -y

Updating Debian explained

Let me explain what you are doing here to update Debian.

apt or the older apt-get are command line based package manager for Debian Linux.

With the apt command, you can install, remove or manage software packages. You can use it to update all the software on your system at once. This includes Linux kernel updates provided by Debian.

sudo apt update

It may seem like this command will update the system but that's not true.

The apt package manager works on a local database of metadata (name, version, description and repository information) about software packages.

When you run the apt update command, it updates this local cache from the Debian repository.

Thanks to this your system can see if an installed package has new version available. In fact, you can see the packages that can be upgraded using:

sudo apt list --upgradable

sudo apt upgrade

This is the command that actually updates your Debian system.

It is important to run the apt update command before so that your system is aware about the availability of the new version of packages.

With that information, the apt upgrade command fetches the new version of the packages from the Debian repositories and installs them.

Thus, all the software component of your Debian systems are upgraded to the newer version.

sudo apt update && sudo apt upgrade -y

The && option is one of the ways to run multiple Linux commands at once.

With &&, the second command apt upgrade -y, runs automatically after the first command finishes successfully.

Why is the -y option used here? Because the apt upgrade needs your conformation before downloading and updating the system. You can save some time by supplying it with yes thanks to the -y.

This way, you don't need a manual intervention while updating Debian. Everything is done in a single command even if it is a combination of multiple commands.

I hope you liked this Debian beginner tip. Do become a member for more Linux tips and tutorials.

Join the conversation.