0

Simple Question, I want to check if a specific package = sp, say gparted is installed on Ubuntu 16.04 server.

2 Answers2

5

Open the terminal and type

apt policy gparted

If there is something next to Installed, it's installed.

gparted:
  Installed: 0.30.0-3ubuntu1
  Candidate: 0.30.0-3ubuntu1
  Version table:
 *** 0.30.0-3ubuntu1 500
        500 ssh://[myserver]/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

If the package exists in the repos your system uses, but is not installed, the output will look like this

ruby:
  Installed: (none)
  Candidate: 1:2.5.1
  Version table:
     1:2.5.1 500
        500 ssh://[myserver]/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

If the package doesn't exist in the repos your system uses, the output will look like this

N: Unable to locate package nosuchapp
Organic Marble
  • 23,641
  • 15
  • 70
  • 122
3

You can check this using debian package tool, dpkg. This works for all debian packages installed in Ubuntu, whether it is installed via apt repo or installed directly via debian package file.

To check if gparted is installed on your machine, first check if you have the binary, then check which package it came from, then lastly you can check the installation of the package.

$ which gparted
/usr/sbin/gparted

$ dpkg -S /usr/sbin/gparted
gparted: /usr/sbin/gparted

$ dpkg -l gparted
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
+++-===============================-====================-====================-===================================================================
ii  gparted                         0.30.0-3ubuntu1      amd64                GNOME partition editor

The ii indicate that the package is installed.

Bernard Wei
  • 2,125