There may come a time when your software has gone awry and you’ll want to know how to reinstall a package in Ubuntu. This article will cover this because it seems like a fine (and short) article and this is indeed a weekend article.
While this is specific to Ubuntu, it’s going to work in any distro out there that uses apt or apt-get. Technically, I’m doing this in Lubuntu, but Ubuntu is a more widely searched term. That’s why I’m going with this one.
So, what are we doing?
Well, we’re going to reinstall a package, that is software, in Ubuntu. We’ll be doing so from the terminal and it’s a very easy process. We will be using the terminal, so open your default terminal by pressing
The tools… You won’t need to install anything new!
If you’ve installed software in the terminal, you’ve probably used apt (Advanced Package Tool). If you do some digging, you’ll see that it’s a front end for apt-get (which is in itself a front end for dpkg, more or less). Apt is the less-stable binary compatible with apt-get. If you want something long-term, use apt-get. If you’re writing an article for this moment in time, feel free to use apt.
When you check the man page, you’ll see apt is described like so:
apt – command-line interface
That’s not particularly helpful. Let’s check the real description:
apt provides a high-level commandline interface for the package management system. It is intended as an end user interface and enables some options better suited for interactive usage by default compared to more specialized APT tools like apt-get(8) and apt-cache(8).
So, as you can now see, this is the correct tool for the job. We’ll definitely be doing stuff in the ‘package management’ category.
I’ll be including apt-get commands by default. Why? For the sake of completeness. It’s not that much effort to add them and the article would be shorter without them. So, I’m using them. Let’s check the man page…
apt-get – APT package handling utility — command-line interface
That’s descriptive enough. You can see that apt-get is a package handling utility and that’s what we’ll be doing. We’ll be handling (managing, if you prefer) packages.
These sorts of tools are installed by default on Ubuntu. They’re also installed by default on Lubuntu, Mint, ElementaryOS, Debian, and many more Debian derivatives. As I said, you won’t have to install anything new for the sake of this article.
Reinstall A Package In Ubuntu:
Let’s say you have some software that’s not behaving quite right. One of the steps you might take is reinstalling the software. Bits may go awry and sometimes things get messed up as you tinker. For whatever reason, you may want to know how to reinstall a package in Ubuntu. Again, that’s what this article covers. (So many people skip the intro!)
I’ve already told you how to open a terminal. This is done in the terminal.
First, we want to talk about how you reinstall a package. The syntax is simple:
sudo apt --reinstall install <package_name>
You can do the same thing with apt-get.
sudo apt-get --reinstall install <package_name>
That will reinstall an application, all nice and easy. It will only reinstall the application. Many applications don’t stand alone but have dependencies.
Fortunately, you can not just reinstall a package in Ubuntu – you can reinstall a package in Ubuntu and reinstall the dependencies. You just need to know what the dependencies are. For that, you’d run this command:
apt-cache depends <package_name>
Once you have that information, you can combine the whole thing into a single command. All you need to do is add the package names to the commands. For example:
sudo apt --reinstall install <package_name> <dependency_name> <dependency2_name>
So, it’s pretty easy to reinstall a package in Ubuntu.
Technically, this was written on a Friday. It’ll be published on a Saturday. So, it’s a weekend article! That means it’s fairly short and fairly easy. I might as well have an easy day. Besides, I wrote another article already today. You won’t see it for a while, but it is written and scheduled for publication. I’m kind of ahead of the game in some regards.
Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.