Today's article is for those who need to know if they've already installed a package...

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
11,809
Reaction score
10,376
Credits
97,674
If you're like me, you can't possibly know all the packages that have been installed on your system. Well, you can get a list of installed applications and pipe them to grep to figure this out. It's nothing fancy. It's nothing complicated. I wrote it on Christmas night, so it's certainly not long. I had other things to occupy me.


Still, it's an article. As they say, "The show must go on!"
 


Definitely good to know, but what I tend to do is just try and install the package: "sudo apt install <whatever>" and it tells me if it has been installed, and if not, it installs it anyway.
 
Definitely good to know, but what I tend to do is just try and install the package: "sudo apt install <whatever>" and it tells me if it has been installed, and if not, it installs it anyway.

That works. You can also just use the GUI software manager to see if it is already installed.
 
It's definitely still good to use dpkg if you are running low on hard drive space, and so you just want the info about what you need for an install.
 
Definitely good to know, but what I tend to do is just try and install the package: "sudo apt install <whatever>" and it tells me if it has been installed, and if not, it installs it anyway.


I don't like the extra fix required (to metadata) if you apt install a package that was already installed.. eg. a quick look on my system will show

Code:
root@d7050-next:~#   apt info hexchat
Package: hexchat
Version: 2.16.1-1build2
Priority: optional
Section: universe/net
..
APT-Manual-Installed: no
..

then if I re-install (where it exists)

Code:
root@d7050-next:~#   apt install hexchat
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
hexchat is already the newest version (2.16.1-1build2).
hexchat set to manually installed.
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
root@d7050-next:~#   apt info hexchat
..
APT-Manual-Installed: yes
..

As I want the package meta data to be correct (that detail is useful for some operations); thus I avoid re-install if I can; OR if I manually correct myself, should I actually need to install --reinstall..., ie.

Code:
root@d7050-next:~#   apt-mark auto hexchat
hexchat set to automatically installed.


As I recall, hexchat was autoinstalled due to my system having xubuntu-desktop installed; I only want that one xubuntu-desktop package to be listed as me having installed in my listings.
 

Members online


Top