Find Out If A Package Is Installed In Debian

Today we’ll have a quick and easy article where we find out if a package is installed in Debian. There are times when you’re unsure of which packages are already installed. Today’s article looks to help with that, letting you know how to find out if a package is already installed.

Depending on where you live, yesterday was a holiday. A nice and easy article seems like a good idea. It’s actually a holiday as I write this, but that’s okay. I’d probably have written it ahead of time but Mother Nature was having her way with me and my neighbors. So, this is being written on Christmas Day. That’s another good reason to keep this short.

If you’re unaware, Debian is a Linux distro. Debian is one of the elders among distros, having just turned 30 not long before writing this article. It’s a very popular distro that has stood the test of time.

Debian also has a whole lot of derivatives. Then, there are derivatives of Debian derivatives. For example, there’s Ubuntu (and all the flavors) which has many derivatives, such as Linux Mint. While less common, there are probably derivatives of derivatives. By now someone has probably at least made a derivative of Linux Mint! (I did not look.)

That means that today’s article will apply to almost all of them. There’s bound to be an outlier, but anything still using apt or dpkg is good to go and will be able to use the information in this article. You won’t need to install anything, but you will need an open terminal.

Find Out If A Package Is Installed In Debian

Today’s article will involve the terminal. You can easily use a GUI for this. Just open your software manager to search for the package name. In this case, we’ll use a terminal and you can usually open your terminal by pressing CTRL + ALT + T.

You won’t need to install anything to determine if a package is installed in Debian. Everything you need, all the tools you’ll need, should be preinstalled. The tools you’ll be using:

dpkg:

You can use dpkg as one tool for this job. Given my preferences, this is the tool I’ll use for this job, simply because I like the output better. If you check the man page, you’ll see dpkg is described like so:

dpkg – package manager for Debian

That’s a pretty good-sounding description for the task. After all, we want to find out if a package is installed in Debian.

The syntax to do this with dpkg is quite simple:

For example (in Mint):

As you can see, Firefox is indeed installed. You should also remember that this operation is case-sensitive. This generally means you want lowercase letters.

apt:

You can also use apt to find out if a package is installed in Debian. If you don’t already know, apt is one of the tools you can use to manage packages in Debian. Think of apt (and apt-get, the stable cousin) as a front-end for Debian’s dpkg. The man page isn’t all that descriptive at first:

apt – command-line interface

But, if you look a little further, you’ll see:

apt provides a high-level commandline interface for the package management system.

So, apt is another fine tool to use for finding out if a package is installed in Debian. It too has a rather simple syntax and it looks like this:

For example (in Mint):

In this case, you can safely ignore the warning. Again, this is case-sensitive and you’ll almost certainly want lowercase letters in your command.

Closure:

See? A nice and easy article for you. It’s not all that difficult to find out if a package is installed in Debian. This is something you can do quite quickly with an open terminal emulator. It’s something easy enough to remember, as well.

Today’s article was nothing too taxing and is something that can come in handy because, if you’re like me, you can’t possibly remember all the packages you’ve installed. Then, when you do install packages, you’re often installing dependencies.

Keeping track of all of those packages manually would be a tedious process! Just a little bit of terminal knowledge makes quick work of this and the commands are easy enough to memorize. Try them a few times and you might just remember them by rote.

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.

Use A GUI To Manage Debian’s Software Repositories

You can manage Debian’s software repositories through the terminal, even by just editing some files. It’s not terribly hard, but there’s an “easier” way, and that’s to do so graphically. It may require some prep work, but it’s remarkably easy after you’ve taken care of that.

People sometimes ask if we prefer the GUI or a terminal, and that’s a complex answer. This is one of those times when it’s split up the middle, at least for me. For example, it’s absurdly easy to add repositories in the terminal, but it’s slightly more complex if you want to then remove those repositories. You need to remember things like the repo’s name – when you can just look in a GUI application and quickly see which repositories you want to remove.

If you’re new to Linux, Debian is a Linux-based operating system that is quite popular to build off. There are tons of derivatives, and even some derivatives of derivatives. Debian was released in 1993 and is the parent of popular distros like Ubuntu, and the grandparent of the many distros based on Ubuntu.

You know, I suspect more people use Debian derivatives than directly use Debian itself.

GUI Manage Debian’s Software Repositories:

I’m going to assume two things:

  1. You have a brand new copy of Debian freshly installed. 
  2. You only downloaded the first .iso and it is no longer mounted. 

Some folks can possibly skip ahead to Step 2.

Step 1: Remove CDROM from your sources

The first thing you’re going to need to do is get rid of the cdrom entries in your apt sources. If you try to install (or update) and have cdrom listed in your sources then you’ll bump into some errors. So, let’s take care of that.

Start your terminal with the trusty CTRL + ALT + T.

To fix that cdrom thing we’re going to need to edit your ‘sources.list’ file. To do that, we enter this in the terminal:

Find the line that starts with ‘cdrom’ and put a # in front of the line to comment it out. It should look a bit like this:

edit debian's sources list
That’s opened after editing. Your version may look different.

Next, save it. Seeing as we’re using nano, you do that pressing CTRL + X, then Y, and then ENTER.

At this point, we need to make sure the system knows we made that change. So, we’re going to update the lists of software available with this command:

That shouldn’t take all that long, especially if it’s a new installation. It takes even less time if you grabbed updates during the installation process. 

Step #2: Install software-properties-gtk

Seeing as you already have your terminal open, you needn’t open a new one. We can do the rest of this in just a single command. It’s actually really easy to do the rest, to set it up to graphically manage Debian’s repositories. Just enter the following command:

Press the ENTER key, type your password if asked, and press on the ENTER key again after entering the ‘y’ response if/when asked.

That’s it. You’re done. When you look in your menu, you should see a new entry called “Software & Updates”. Root around in the tabs and revel in your new tool to manage repos and a few other things.

Software & Updates on Debian
See? Mission accomplished and it wasn’t even all that painful! Congratulations!

You manage the main repositories on the first tab and can manage other repositories with the second tab. You can graphically manage Debian’s repositories without a whole lot of extra work. The hardest part was in removing the cdrom from the software sources. There are some other tools included, but those are the two main tools – or the two main tools that this article focuses upon.

Closure:

And there you have it! You have a new article. This one told you how to graphically manage Debian’s repositories. All in all, I’d say it’s pretty easy and something a fairly new user should be able to do on their own. Good luck and ask questions if you get stuck.

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 own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.