Debian

How to Use apt or apt-get reinstall on Debian 11 Bullseye

The APT (Advanced Packaging Tool) is a default package manager for Debian that manages the installation, upgradation of a package or a whole system, and removal of packages. The apt or apt-get are widely used commands for installing the packages from the default system repository. Besides, installing, you can use these commands to reinstall a package using the reinstall command in case there is an error in the installed package.

Learn how to use apt or apt-get reinstall on the Debian system through this guide.

How to Use apt or apt-get reinstall on Debian 11 Bullseye

The apt provides a high-level interface for managing the packages through the command line in Linux. Both apt and apt-get commands take the reinstall argument for the reinstallation of the packages.

How to Use apt reinstall on Debian 11 Bullseye

To use the apt reinstall command on Debian, follow the below-given syntax:

sudo apt --reinstall install <package_name>

Note: In the above command, you must specify the package_name to perform the reinstallation of that package on Debian.

Here, I am reinstalling the htop package on Debian via the apt command as shown below:

sudo apt --reinstall install htop

How to Use apt-get reinstall on Debian 11 Bullseye

Similarly in the same way, you can use the apt-get reinstall command to perform the reinstallation of a package.

The syntax of the apt-get reinstall command is as follows:

sudo apt-get --reinstall install <package_name>

In the above command, replace <package_name> with the name of the package you want to install using the apt-get reinstall command.

Here, I am reinstalling the rsync package and its dependencies on Debian:

sudo apt-get --reinstall install rsync

Reinstalling Multiple Packages Through apt or apt-get reinstall

You can also use the apt or apt-get reinstall command to install multiple packages on a single go.

The following is the syntax to reinstall multiple packages through apt or apt-get reinstall commands:

sudo apt --reinstall install <package1> <package2> <package3>.....

Or:

sudo apt-get --reinstall install <package1> <package2> <package3>.....

For example, in the below given command, I am performing the reinstallation of the rsync and htop on Debian 11:

sudo apt-get --reinstall install rsync htop

Bottom Line

The Debian users can reinstall packages on the system by using the apt or apt-get reinstall command. The syntax to use these commands is given in the above-mentioned guidelines. Further, you can also use these commands to reinstall multiple packages at the same time through a single command. It depends on the user’s choice, which command they want to prefer either apt or apt-get. Both will reinstall the package from the Debian repository.

About the author

Zainab Rehman

I'm an author by profession. My interest in the internet world motivates me to write for Linux Hint and I'm here to share my knowledge with others.