There may be times when you or any program modify files in the package unnecessarily. The other case is that the files in a package can be accidentally deleted. In both situations, there are chances of your system being damaged. Most of the time, users install the respective package again and solve the problems. However, when you use the apt-get install command, you will get an error indicating that the package is already present.
The -reinstall flag serves as a shortcut for an apt-get command. Used to reinstall packages while using the most up-to-date versions. This is very beneficial for packages with various inverse dependencies. In this guide, you will learn how to use apt-get reinstall to reinstall packages on Debian and Ubuntu.
Also, you should note here that employing the -purge remove option to remove packages and install them again will give you similar results. But, it will also delete the configuration files.
Before we move on to the steps to reinstall
packages that employ apt-get reinstall, let us tell you the prerequisites you need to meet first:
You must have
- an account that has sudo privileges
- You need to have access to the command line/terminal.
- You must have a Debian/Ubuntu system.
Reinstall packages using apt-get
There is a simple process to use the -reinstall command. Enter the following
syntax: sudo apt reinstall <install PackageName> Also, if you need to reinstall
more than one package, you have the possibility to list them all on one line using the syntax
– sudo apt reinstall install PackageName1 PackageName2
Reinstall htop Using apt-get htop
is an interactive process viewer in Ubuntu. To reinstall htop using the -reinstall prompt, you can enter the apt-get command as –
sudo apt reinstall install htop
Reinstall packages using the command
aptitude Aptitude serves as a graphical user interface when it comes to the apt package manager. However, you can also use it with the command line. If you need to reinstall a package with aptitude, enter the following syntax:
sudo aptitude reinstall PackageName
Also, you can make use of the command –
sudo aptitude reinstall ‘
if you want to reinstall ALL packages.
src=”https://www.hostbillo.com/blog/wp-content/uploads/2022/06/image1.png” alt=”Reinstall packages using aptitude command” />
Reinstall apt after you have accidentally deleted it
In case you delete the apt accidentally and want an apt-get reinstall package, you can perform a forced reinstall apt-get. It will take you the following three steps
- : First, browse https://packages.debian.org/apt to find the version you prefer. Also, you should avoid unstable testing or versions.
- Then opt for the required and preferred version number. And then, download the package for your architecture.
- In the last step, run the following command in the terminal:
sudo dpkg -i apt_0.5.4_i386.deb
Also read: How to Install Ubuntu Together with Windows on Dual Boot | Conclusion of Hostbillo
Going through this thorough tutorial, one may be able to reinstall packages using apt-get and aptitude commands. In addition, one will also be able to restore apt or perform apt-get reinstall if it has been accidentally deleted. Also, you can always connect with Hostbillo experts while encountering some difficulty when reinstalling Ubuntu server from terminal or packages using apt-get reinstall. We, along with our experts, are available through multiple modes of communication to help you get solutions in the shortest possible time.