-1

I'm trying to check if a package is installed or not.

Here is a link for finding all packages with "deinstall" status: dpkg --get-selections shows packages marked "deinstall"

But I can't find any packages with "deinstall" from my running Ubuntu system.

What command can be used to make a "installed" package become the "deinstall" for testing purpose?

stackbiz
  • 495

1 Answers1

0
$ dpkg -l | head -n 4
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                          Version                                  Architecture Description

Note all those | and / characters in the left edge... they are meant to point out the first two (three?) characters in the list of packages that follow these four lines (when you remove head -n 4 and actually list the packages).

If the two first characters are
ii - then the package listed on that line is actually installed

All other possible combinations are listed in those first four lines.

So
dpkg -l | grep -E '^ii' lists all actually installed packages.
dpkg -l | grep -E '^.H' should list software in Half-inst state.

I'm not sure what "deinstall" would correspond to.

Then
sudo apt install package-name - to install a package
sudo apt remove package-name - to remove (uninstall) a package
sudo apt purge package-name - to remove a package and it's config/settings files.

Hannu
  • 6,605
  • 1
  • 28
  • 45