How to find out if a specific package is installed on Debian?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
8
down vote

favorite
1












I'm working with a Raspberry Pi B+ and Raspbian 5/5/2015 and some guides that are a few years old. I've got an external NTFS HDD hooked up to the Pi. Due to the articles age(s), common practices have changed, and it turns out that certain packages and features and functions are now built-in and/or automatic. So, as I'm trying to follow along n00bish guides (because I'm a n00b when it comes to Linux stuff), and I'm having to experiment to see what from the guide actually needs to be done. Fun right?



For example, I found out that Raspbian will handle the automounting of an NTFS drive/volume if you just install ntfs-3g. All instructions and guidance I could find (IRC, raspberry pi forum, and a Linux dude I know) all went extremely technical doing who-knows-what to my system to try to assist me, when in reality we were all tripping over automatic features that no one knew about or thought to check. I've since installed Raspbian fresh to a new SD card and so far just turned on SSH, updated apt-get, and installed ntfs-3g.



This is the article I am using right now: http://www.howtogeek.com/139433/how-to-turn-a-raspberry-pi-into-a-low-power-network-storage-device/?PageSpeed=noscript



My next step is to get Samba up and running. Yes, I know Linux people hate Windows, but I'm a Windows guy, so until I can know enough about Linux for a Linux system to be my fallback, Windows machines are my fallbacks. Eventually this Raspberry Pi will get a multi-TB drive, though for right now it's just a few GB; which is why it needs to be NTFS.



I would like to check if Samba is installed, since the next step in my instructions tell me how to install and configure it. I've tried a few commands and I'm not sure what to do with the results or how to use them. I searched here and the technical details are above my capabilities and I don't think they address my seemingly simple need to find out if a package is installed or not.



I tried:



apt-cache dump


this gave me way too much data. It scrolled down for a few minutes. I got this from The Raspberry Pi Handbook 3rd Edition (Link - Amazon)



I tried



apt-cache showpkg samba
Package: samba
Versions:
2:3.6.6-6+deb7u5 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_ wheezy_main_binary-armhf_Packages)
Description Language:
File: /var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_d ists_wheezy_main_binary-armhf_Packages
MD5: 0122ac62ef5f4ae21eb2e195eb45ad1d


Reverse Depends:
winbind,samba 2.2.3-2
task-file-server,samba
swat,samba 2:3.6.6-6+deb7u5
smbclient,samba 2.999+3.0.alpha21-4
samba4-common-bin,samba 2:3.3.0~rc2-5
samba4,samba 2:3.3.0~rc2-5
samba-dbg,samba 2:3.6.6-6+deb7u5
samba-common-bin,samba 3.0.20b-1
samba-common,samba 3.0.20b-1
qtsmbstatus-server,samba
qemu-system,samba
nautilus-share,samba 3.0.27a
libwbclient0,samba 2:3.4.1
libpam-winbind,samba 2.2.3-2
libpam-smbpass,samba
libnss-winbind,samba 2.2.3-2
gadmin-samba,samba
education-main-server,samba
dpsyco-samba,samba
Dependencies:
2:3.6.6-6+deb7u5 - samba-common (5 2:3.6.6-6+deb7u5) libwbclient0 (5 2:3.6.6-6+d eb7u5) libacl1 (2 2.2.51-8) libattr1 (2 1:2.4.46-8) libc6 (2 2.13-28) libcap2 (2 2.10) libcomerr2 (2 1.01) libcups2 (2 1.4.0) libgcc1 (2 1:4.4.0) libgssapi-krb5 -2 (2 1.10+dfsg~) libk5crypto3 (2 1.6.dfsg.2) libkrb5-3 (2 1.10+dfsg~) libldap-2 .4-2 (2 2.4.7) libpam0g (2 0.99.7.1) libpopt0 (2 1.14) libtalloc2 (2 2.0.4~git20 101213) libtdb1 (2 1.2.7+git20101214) zlib1g (2 1:1.1.4) debconf (18 0.5) debcon f-2.0 (0 (null)) libpam-runtime (2 1.0.1-11) libpam-modules (0 (null)) lsb-base (2 3.2-13) procps (0 (null)) update-inetd (0 (null)) adduser (0 (null)) dpkg (2 1.15.7.2) openbsd-inetd (16 (null)) inet-superserver (0 (null)) smbldap-tools (0 (null)) ldb-tools (0 (null)) ctdb (0 (null)) logrotate (0 (null)) tdb-tools (0 (null)) samba4 (3 4.0.0~alpha6-2) samba-common (1 2.0.5a-2)
Provides:
2:3.6.6-6+deb7u5 -
Reverse Provides:
pi@raspberrypi ~ $ apt-cache showpkg ntfs-3g
Package: ntfs-3g
Versions:
1:2012.1.15AR.5-2.1+deb7u2 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages) (/var/lib/dpkg/status)
Description Language:
File: /var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages
MD5: b2df024e8627b5d253b85f35263376ef


Reverse Depends:
udisks,ntfs-3g
ntfsprogs,ntfs-3g
ntfs-config,ntfs-3g
ntfs-3g-dev,ntfs-3g 1:2012.1.15AR.5-2.1+deb7u2
ntfs-3g-dbg,ntfs-3g 1:2012.1.15AR.5-2.1+deb7u2
kvpm,ntfs-3g
fsarchiver,ntfs-3g
Dependencies:
1:2012.1.15AR.5-2.1+deb7u2 - debconf (18 0.5) debconf-2.0 (0 (null)) libc6 (2 2.13-28) libfuse2 (2 2.8.1) libgcc1 (2 1:4.4.0) libgcrypt11 (2 1.4.5) libgnutls26 (2 2.12.17-0) multiarch-support (0 (null)) fuse (0 (null)) libntfs-3g75 (0 (null)) ntfsprogs (3 1:2011.10.9AR.1-3~) libntfs-3g75 (0 (null)) ntfsprogs (0 (null))
Provides:
1:2012.1.15AR.5-2.1+deb7u2 -
Reverse Provides:
pi@raspberrypi ~ $ apt-cache showpkg ntfsprogs
Package: ntfsprogs
Versions:
1:2012.1.15AR.5-2.1+deb7u2 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages)
Description Language:
File: /var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages
MD5: 95f41af9cf1d0b5b66afb7d2a9e7c75d


Reverse Depends:
partitionmanager,ntfsprogs
ntfs-3g,ntfsprogs
ntfs-3g,ntfsprogs 1:2011.10.9AR.1-3~
gparted,ntfsprogs
fsarchiver,ntfsprogs
fai-setup-storage,ntfsprogs
Dependencies:
1:2012.1.15AR.5-2.1+deb7u2 - ntfs-3g (0 (null))
Provides:
1:2012.1.15AR.5-2.1+deb7u2 -
Reverse Provides:


but I'm not sure what to make of the results. I can't tell if it's going to apt-get the servers and getting information, or pulling it from my system.



I tried :



dpkg --get-selections


which I got from here:
http://www.howtogeek.com/howto/linux/show-the-list-of-installed-packages-on-ubuntu-or-debian/?PageSpeed=noscript
but I think I'm running into the same problem. It seems the syntax has changed since 2007. The man page / help file seems to lead me to believe that the command should work



Usage: dpkg [<option> ...] <command>

--get-selections [<pattern> ...] Get list of selections to stdout.


but I get an error:



dpkg –get-selections samba
dpkg: error: need an action option


I found a few wuestions here that are related, but don't give me what I am looking for. I am interested in just knowing what's installed, but I guess that's a topic for another question.



  • What packages are installed by default in Debian? Is there a term for that set? Why some of those packages are `automatically installed` and some not?

  • How do we know what applications are installed in Linux?

  • Loop to check whether a Debian package is installed or not

  • Determine if a package is provided by an installed packagein Arch Linux









share|improve this question























  • Are Raspban and Debian interchangeable? I would think not since Raspbian is specific to the Raspberry Pi and Debian probably can run on multiple hardware platforms.
    – YetAnotherRandomUser
    Jul 19 '15 at 22:49










  • Raspbian and Debian are not interchangeable, but Raspbian is a Debian derivative with the same package management mechanisms. The answers below using commands like apt-cache and dpkg apply equally to both (and to Ubuntu, Linux Mint, etc.)
    – Benjamin Staton
    Jul 11 '17 at 22:45














up vote
8
down vote

favorite
1












I'm working with a Raspberry Pi B+ and Raspbian 5/5/2015 and some guides that are a few years old. I've got an external NTFS HDD hooked up to the Pi. Due to the articles age(s), common practices have changed, and it turns out that certain packages and features and functions are now built-in and/or automatic. So, as I'm trying to follow along n00bish guides (because I'm a n00b when it comes to Linux stuff), and I'm having to experiment to see what from the guide actually needs to be done. Fun right?



For example, I found out that Raspbian will handle the automounting of an NTFS drive/volume if you just install ntfs-3g. All instructions and guidance I could find (IRC, raspberry pi forum, and a Linux dude I know) all went extremely technical doing who-knows-what to my system to try to assist me, when in reality we were all tripping over automatic features that no one knew about or thought to check. I've since installed Raspbian fresh to a new SD card and so far just turned on SSH, updated apt-get, and installed ntfs-3g.



This is the article I am using right now: http://www.howtogeek.com/139433/how-to-turn-a-raspberry-pi-into-a-low-power-network-storage-device/?PageSpeed=noscript



My next step is to get Samba up and running. Yes, I know Linux people hate Windows, but I'm a Windows guy, so until I can know enough about Linux for a Linux system to be my fallback, Windows machines are my fallbacks. Eventually this Raspberry Pi will get a multi-TB drive, though for right now it's just a few GB; which is why it needs to be NTFS.



I would like to check if Samba is installed, since the next step in my instructions tell me how to install and configure it. I've tried a few commands and I'm not sure what to do with the results or how to use them. I searched here and the technical details are above my capabilities and I don't think they address my seemingly simple need to find out if a package is installed or not.



I tried:



apt-cache dump


this gave me way too much data. It scrolled down for a few minutes. I got this from The Raspberry Pi Handbook 3rd Edition (Link - Amazon)



I tried



apt-cache showpkg samba
Package: samba
Versions:
2:3.6.6-6+deb7u5 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_ wheezy_main_binary-armhf_Packages)
Description Language:
File: /var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_d ists_wheezy_main_binary-armhf_Packages
MD5: 0122ac62ef5f4ae21eb2e195eb45ad1d


Reverse Depends:
winbind,samba 2.2.3-2
task-file-server,samba
swat,samba 2:3.6.6-6+deb7u5
smbclient,samba 2.999+3.0.alpha21-4
samba4-common-bin,samba 2:3.3.0~rc2-5
samba4,samba 2:3.3.0~rc2-5
samba-dbg,samba 2:3.6.6-6+deb7u5
samba-common-bin,samba 3.0.20b-1
samba-common,samba 3.0.20b-1
qtsmbstatus-server,samba
qemu-system,samba
nautilus-share,samba 3.0.27a
libwbclient0,samba 2:3.4.1
libpam-winbind,samba 2.2.3-2
libpam-smbpass,samba
libnss-winbind,samba 2.2.3-2
gadmin-samba,samba
education-main-server,samba
dpsyco-samba,samba
Dependencies:
2:3.6.6-6+deb7u5 - samba-common (5 2:3.6.6-6+deb7u5) libwbclient0 (5 2:3.6.6-6+d eb7u5) libacl1 (2 2.2.51-8) libattr1 (2 1:2.4.46-8) libc6 (2 2.13-28) libcap2 (2 2.10) libcomerr2 (2 1.01) libcups2 (2 1.4.0) libgcc1 (2 1:4.4.0) libgssapi-krb5 -2 (2 1.10+dfsg~) libk5crypto3 (2 1.6.dfsg.2) libkrb5-3 (2 1.10+dfsg~) libldap-2 .4-2 (2 2.4.7) libpam0g (2 0.99.7.1) libpopt0 (2 1.14) libtalloc2 (2 2.0.4~git20 101213) libtdb1 (2 1.2.7+git20101214) zlib1g (2 1:1.1.4) debconf (18 0.5) debcon f-2.0 (0 (null)) libpam-runtime (2 1.0.1-11) libpam-modules (0 (null)) lsb-base (2 3.2-13) procps (0 (null)) update-inetd (0 (null)) adduser (0 (null)) dpkg (2 1.15.7.2) openbsd-inetd (16 (null)) inet-superserver (0 (null)) smbldap-tools (0 (null)) ldb-tools (0 (null)) ctdb (0 (null)) logrotate (0 (null)) tdb-tools (0 (null)) samba4 (3 4.0.0~alpha6-2) samba-common (1 2.0.5a-2)
Provides:
2:3.6.6-6+deb7u5 -
Reverse Provides:
pi@raspberrypi ~ $ apt-cache showpkg ntfs-3g
Package: ntfs-3g
Versions:
1:2012.1.15AR.5-2.1+deb7u2 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages) (/var/lib/dpkg/status)
Description Language:
File: /var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages
MD5: b2df024e8627b5d253b85f35263376ef


Reverse Depends:
udisks,ntfs-3g
ntfsprogs,ntfs-3g
ntfs-config,ntfs-3g
ntfs-3g-dev,ntfs-3g 1:2012.1.15AR.5-2.1+deb7u2
ntfs-3g-dbg,ntfs-3g 1:2012.1.15AR.5-2.1+deb7u2
kvpm,ntfs-3g
fsarchiver,ntfs-3g
Dependencies:
1:2012.1.15AR.5-2.1+deb7u2 - debconf (18 0.5) debconf-2.0 (0 (null)) libc6 (2 2.13-28) libfuse2 (2 2.8.1) libgcc1 (2 1:4.4.0) libgcrypt11 (2 1.4.5) libgnutls26 (2 2.12.17-0) multiarch-support (0 (null)) fuse (0 (null)) libntfs-3g75 (0 (null)) ntfsprogs (3 1:2011.10.9AR.1-3~) libntfs-3g75 (0 (null)) ntfsprogs (0 (null))
Provides:
1:2012.1.15AR.5-2.1+deb7u2 -
Reverse Provides:
pi@raspberrypi ~ $ apt-cache showpkg ntfsprogs
Package: ntfsprogs
Versions:
1:2012.1.15AR.5-2.1+deb7u2 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages)
Description Language:
File: /var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages
MD5: 95f41af9cf1d0b5b66afb7d2a9e7c75d


Reverse Depends:
partitionmanager,ntfsprogs
ntfs-3g,ntfsprogs
ntfs-3g,ntfsprogs 1:2011.10.9AR.1-3~
gparted,ntfsprogs
fsarchiver,ntfsprogs
fai-setup-storage,ntfsprogs
Dependencies:
1:2012.1.15AR.5-2.1+deb7u2 - ntfs-3g (0 (null))
Provides:
1:2012.1.15AR.5-2.1+deb7u2 -
Reverse Provides:


but I'm not sure what to make of the results. I can't tell if it's going to apt-get the servers and getting information, or pulling it from my system.



I tried :



dpkg --get-selections


which I got from here:
http://www.howtogeek.com/howto/linux/show-the-list-of-installed-packages-on-ubuntu-or-debian/?PageSpeed=noscript
but I think I'm running into the same problem. It seems the syntax has changed since 2007. The man page / help file seems to lead me to believe that the command should work



Usage: dpkg [<option> ...] <command>

--get-selections [<pattern> ...] Get list of selections to stdout.


but I get an error:



dpkg –get-selections samba
dpkg: error: need an action option


I found a few wuestions here that are related, but don't give me what I am looking for. I am interested in just knowing what's installed, but I guess that's a topic for another question.



  • What packages are installed by default in Debian? Is there a term for that set? Why some of those packages are `automatically installed` and some not?

  • How do we know what applications are installed in Linux?

  • Loop to check whether a Debian package is installed or not

  • Determine if a package is provided by an installed packagein Arch Linux









share|improve this question























  • Are Raspban and Debian interchangeable? I would think not since Raspbian is specific to the Raspberry Pi and Debian probably can run on multiple hardware platforms.
    – YetAnotherRandomUser
    Jul 19 '15 at 22:49










  • Raspbian and Debian are not interchangeable, but Raspbian is a Debian derivative with the same package management mechanisms. The answers below using commands like apt-cache and dpkg apply equally to both (and to Ubuntu, Linux Mint, etc.)
    – Benjamin Staton
    Jul 11 '17 at 22:45












up vote
8
down vote

favorite
1









up vote
8
down vote

favorite
1






1





I'm working with a Raspberry Pi B+ and Raspbian 5/5/2015 and some guides that are a few years old. I've got an external NTFS HDD hooked up to the Pi. Due to the articles age(s), common practices have changed, and it turns out that certain packages and features and functions are now built-in and/or automatic. So, as I'm trying to follow along n00bish guides (because I'm a n00b when it comes to Linux stuff), and I'm having to experiment to see what from the guide actually needs to be done. Fun right?



For example, I found out that Raspbian will handle the automounting of an NTFS drive/volume if you just install ntfs-3g. All instructions and guidance I could find (IRC, raspberry pi forum, and a Linux dude I know) all went extremely technical doing who-knows-what to my system to try to assist me, when in reality we were all tripping over automatic features that no one knew about or thought to check. I've since installed Raspbian fresh to a new SD card and so far just turned on SSH, updated apt-get, and installed ntfs-3g.



This is the article I am using right now: http://www.howtogeek.com/139433/how-to-turn-a-raspberry-pi-into-a-low-power-network-storage-device/?PageSpeed=noscript



My next step is to get Samba up and running. Yes, I know Linux people hate Windows, but I'm a Windows guy, so until I can know enough about Linux for a Linux system to be my fallback, Windows machines are my fallbacks. Eventually this Raspberry Pi will get a multi-TB drive, though for right now it's just a few GB; which is why it needs to be NTFS.



I would like to check if Samba is installed, since the next step in my instructions tell me how to install and configure it. I've tried a few commands and I'm not sure what to do with the results or how to use them. I searched here and the technical details are above my capabilities and I don't think they address my seemingly simple need to find out if a package is installed or not.



I tried:



apt-cache dump


this gave me way too much data. It scrolled down for a few minutes. I got this from The Raspberry Pi Handbook 3rd Edition (Link - Amazon)



I tried



apt-cache showpkg samba
Package: samba
Versions:
2:3.6.6-6+deb7u5 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_ wheezy_main_binary-armhf_Packages)
Description Language:
File: /var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_d ists_wheezy_main_binary-armhf_Packages
MD5: 0122ac62ef5f4ae21eb2e195eb45ad1d


Reverse Depends:
winbind,samba 2.2.3-2
task-file-server,samba
swat,samba 2:3.6.6-6+deb7u5
smbclient,samba 2.999+3.0.alpha21-4
samba4-common-bin,samba 2:3.3.0~rc2-5
samba4,samba 2:3.3.0~rc2-5
samba-dbg,samba 2:3.6.6-6+deb7u5
samba-common-bin,samba 3.0.20b-1
samba-common,samba 3.0.20b-1
qtsmbstatus-server,samba
qemu-system,samba
nautilus-share,samba 3.0.27a
libwbclient0,samba 2:3.4.1
libpam-winbind,samba 2.2.3-2
libpam-smbpass,samba
libnss-winbind,samba 2.2.3-2
gadmin-samba,samba
education-main-server,samba
dpsyco-samba,samba
Dependencies:
2:3.6.6-6+deb7u5 - samba-common (5 2:3.6.6-6+deb7u5) libwbclient0 (5 2:3.6.6-6+d eb7u5) libacl1 (2 2.2.51-8) libattr1 (2 1:2.4.46-8) libc6 (2 2.13-28) libcap2 (2 2.10) libcomerr2 (2 1.01) libcups2 (2 1.4.0) libgcc1 (2 1:4.4.0) libgssapi-krb5 -2 (2 1.10+dfsg~) libk5crypto3 (2 1.6.dfsg.2) libkrb5-3 (2 1.10+dfsg~) libldap-2 .4-2 (2 2.4.7) libpam0g (2 0.99.7.1) libpopt0 (2 1.14) libtalloc2 (2 2.0.4~git20 101213) libtdb1 (2 1.2.7+git20101214) zlib1g (2 1:1.1.4) debconf (18 0.5) debcon f-2.0 (0 (null)) libpam-runtime (2 1.0.1-11) libpam-modules (0 (null)) lsb-base (2 3.2-13) procps (0 (null)) update-inetd (0 (null)) adduser (0 (null)) dpkg (2 1.15.7.2) openbsd-inetd (16 (null)) inet-superserver (0 (null)) smbldap-tools (0 (null)) ldb-tools (0 (null)) ctdb (0 (null)) logrotate (0 (null)) tdb-tools (0 (null)) samba4 (3 4.0.0~alpha6-2) samba-common (1 2.0.5a-2)
Provides:
2:3.6.6-6+deb7u5 -
Reverse Provides:
pi@raspberrypi ~ $ apt-cache showpkg ntfs-3g
Package: ntfs-3g
Versions:
1:2012.1.15AR.5-2.1+deb7u2 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages) (/var/lib/dpkg/status)
Description Language:
File: /var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages
MD5: b2df024e8627b5d253b85f35263376ef


Reverse Depends:
udisks,ntfs-3g
ntfsprogs,ntfs-3g
ntfs-config,ntfs-3g
ntfs-3g-dev,ntfs-3g 1:2012.1.15AR.5-2.1+deb7u2
ntfs-3g-dbg,ntfs-3g 1:2012.1.15AR.5-2.1+deb7u2
kvpm,ntfs-3g
fsarchiver,ntfs-3g
Dependencies:
1:2012.1.15AR.5-2.1+deb7u2 - debconf (18 0.5) debconf-2.0 (0 (null)) libc6 (2 2.13-28) libfuse2 (2 2.8.1) libgcc1 (2 1:4.4.0) libgcrypt11 (2 1.4.5) libgnutls26 (2 2.12.17-0) multiarch-support (0 (null)) fuse (0 (null)) libntfs-3g75 (0 (null)) ntfsprogs (3 1:2011.10.9AR.1-3~) libntfs-3g75 (0 (null)) ntfsprogs (0 (null))
Provides:
1:2012.1.15AR.5-2.1+deb7u2 -
Reverse Provides:
pi@raspberrypi ~ $ apt-cache showpkg ntfsprogs
Package: ntfsprogs
Versions:
1:2012.1.15AR.5-2.1+deb7u2 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages)
Description Language:
File: /var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages
MD5: 95f41af9cf1d0b5b66afb7d2a9e7c75d


Reverse Depends:
partitionmanager,ntfsprogs
ntfs-3g,ntfsprogs
ntfs-3g,ntfsprogs 1:2011.10.9AR.1-3~
gparted,ntfsprogs
fsarchiver,ntfsprogs
fai-setup-storage,ntfsprogs
Dependencies:
1:2012.1.15AR.5-2.1+deb7u2 - ntfs-3g (0 (null))
Provides:
1:2012.1.15AR.5-2.1+deb7u2 -
Reverse Provides:


but I'm not sure what to make of the results. I can't tell if it's going to apt-get the servers and getting information, or pulling it from my system.



I tried :



dpkg --get-selections


which I got from here:
http://www.howtogeek.com/howto/linux/show-the-list-of-installed-packages-on-ubuntu-or-debian/?PageSpeed=noscript
but I think I'm running into the same problem. It seems the syntax has changed since 2007. The man page / help file seems to lead me to believe that the command should work



Usage: dpkg [<option> ...] <command>

--get-selections [<pattern> ...] Get list of selections to stdout.


but I get an error:



dpkg –get-selections samba
dpkg: error: need an action option


I found a few wuestions here that are related, but don't give me what I am looking for. I am interested in just knowing what's installed, but I guess that's a topic for another question.



  • What packages are installed by default in Debian? Is there a term for that set? Why some of those packages are `automatically installed` and some not?

  • How do we know what applications are installed in Linux?

  • Loop to check whether a Debian package is installed or not

  • Determine if a package is provided by an installed packagein Arch Linux









share|improve this question















I'm working with a Raspberry Pi B+ and Raspbian 5/5/2015 and some guides that are a few years old. I've got an external NTFS HDD hooked up to the Pi. Due to the articles age(s), common practices have changed, and it turns out that certain packages and features and functions are now built-in and/or automatic. So, as I'm trying to follow along n00bish guides (because I'm a n00b when it comes to Linux stuff), and I'm having to experiment to see what from the guide actually needs to be done. Fun right?



For example, I found out that Raspbian will handle the automounting of an NTFS drive/volume if you just install ntfs-3g. All instructions and guidance I could find (IRC, raspberry pi forum, and a Linux dude I know) all went extremely technical doing who-knows-what to my system to try to assist me, when in reality we were all tripping over automatic features that no one knew about or thought to check. I've since installed Raspbian fresh to a new SD card and so far just turned on SSH, updated apt-get, and installed ntfs-3g.



This is the article I am using right now: http://www.howtogeek.com/139433/how-to-turn-a-raspberry-pi-into-a-low-power-network-storage-device/?PageSpeed=noscript



My next step is to get Samba up and running. Yes, I know Linux people hate Windows, but I'm a Windows guy, so until I can know enough about Linux for a Linux system to be my fallback, Windows machines are my fallbacks. Eventually this Raspberry Pi will get a multi-TB drive, though for right now it's just a few GB; which is why it needs to be NTFS.



I would like to check if Samba is installed, since the next step in my instructions tell me how to install and configure it. I've tried a few commands and I'm not sure what to do with the results or how to use them. I searched here and the technical details are above my capabilities and I don't think they address my seemingly simple need to find out if a package is installed or not.



I tried:



apt-cache dump


this gave me way too much data. It scrolled down for a few minutes. I got this from The Raspberry Pi Handbook 3rd Edition (Link - Amazon)



I tried



apt-cache showpkg samba
Package: samba
Versions:
2:3.6.6-6+deb7u5 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_ wheezy_main_binary-armhf_Packages)
Description Language:
File: /var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_d ists_wheezy_main_binary-armhf_Packages
MD5: 0122ac62ef5f4ae21eb2e195eb45ad1d


Reverse Depends:
winbind,samba 2.2.3-2
task-file-server,samba
swat,samba 2:3.6.6-6+deb7u5
smbclient,samba 2.999+3.0.alpha21-4
samba4-common-bin,samba 2:3.3.0~rc2-5
samba4,samba 2:3.3.0~rc2-5
samba-dbg,samba 2:3.6.6-6+deb7u5
samba-common-bin,samba 3.0.20b-1
samba-common,samba 3.0.20b-1
qtsmbstatus-server,samba
qemu-system,samba
nautilus-share,samba 3.0.27a
libwbclient0,samba 2:3.4.1
libpam-winbind,samba 2.2.3-2
libpam-smbpass,samba
libnss-winbind,samba 2.2.3-2
gadmin-samba,samba
education-main-server,samba
dpsyco-samba,samba
Dependencies:
2:3.6.6-6+deb7u5 - samba-common (5 2:3.6.6-6+deb7u5) libwbclient0 (5 2:3.6.6-6+d eb7u5) libacl1 (2 2.2.51-8) libattr1 (2 1:2.4.46-8) libc6 (2 2.13-28) libcap2 (2 2.10) libcomerr2 (2 1.01) libcups2 (2 1.4.0) libgcc1 (2 1:4.4.0) libgssapi-krb5 -2 (2 1.10+dfsg~) libk5crypto3 (2 1.6.dfsg.2) libkrb5-3 (2 1.10+dfsg~) libldap-2 .4-2 (2 2.4.7) libpam0g (2 0.99.7.1) libpopt0 (2 1.14) libtalloc2 (2 2.0.4~git20 101213) libtdb1 (2 1.2.7+git20101214) zlib1g (2 1:1.1.4) debconf (18 0.5) debcon f-2.0 (0 (null)) libpam-runtime (2 1.0.1-11) libpam-modules (0 (null)) lsb-base (2 3.2-13) procps (0 (null)) update-inetd (0 (null)) adduser (0 (null)) dpkg (2 1.15.7.2) openbsd-inetd (16 (null)) inet-superserver (0 (null)) smbldap-tools (0 (null)) ldb-tools (0 (null)) ctdb (0 (null)) logrotate (0 (null)) tdb-tools (0 (null)) samba4 (3 4.0.0~alpha6-2) samba-common (1 2.0.5a-2)
Provides:
2:3.6.6-6+deb7u5 -
Reverse Provides:
pi@raspberrypi ~ $ apt-cache showpkg ntfs-3g
Package: ntfs-3g
Versions:
1:2012.1.15AR.5-2.1+deb7u2 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages) (/var/lib/dpkg/status)
Description Language:
File: /var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages
MD5: b2df024e8627b5d253b85f35263376ef


Reverse Depends:
udisks,ntfs-3g
ntfsprogs,ntfs-3g
ntfs-config,ntfs-3g
ntfs-3g-dev,ntfs-3g 1:2012.1.15AR.5-2.1+deb7u2
ntfs-3g-dbg,ntfs-3g 1:2012.1.15AR.5-2.1+deb7u2
kvpm,ntfs-3g
fsarchiver,ntfs-3g
Dependencies:
1:2012.1.15AR.5-2.1+deb7u2 - debconf (18 0.5) debconf-2.0 (0 (null)) libc6 (2 2.13-28) libfuse2 (2 2.8.1) libgcc1 (2 1:4.4.0) libgcrypt11 (2 1.4.5) libgnutls26 (2 2.12.17-0) multiarch-support (0 (null)) fuse (0 (null)) libntfs-3g75 (0 (null)) ntfsprogs (3 1:2011.10.9AR.1-3~) libntfs-3g75 (0 (null)) ntfsprogs (0 (null))
Provides:
1:2012.1.15AR.5-2.1+deb7u2 -
Reverse Provides:
pi@raspberrypi ~ $ apt-cache showpkg ntfsprogs
Package: ntfsprogs
Versions:
1:2012.1.15AR.5-2.1+deb7u2 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages)
Description Language:
File: /var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages
MD5: 95f41af9cf1d0b5b66afb7d2a9e7c75d


Reverse Depends:
partitionmanager,ntfsprogs
ntfs-3g,ntfsprogs
ntfs-3g,ntfsprogs 1:2011.10.9AR.1-3~
gparted,ntfsprogs
fsarchiver,ntfsprogs
fai-setup-storage,ntfsprogs
Dependencies:
1:2012.1.15AR.5-2.1+deb7u2 - ntfs-3g (0 (null))
Provides:
1:2012.1.15AR.5-2.1+deb7u2 -
Reverse Provides:


but I'm not sure what to make of the results. I can't tell if it's going to apt-get the servers and getting information, or pulling it from my system.



I tried :



dpkg --get-selections


which I got from here:
http://www.howtogeek.com/howto/linux/show-the-list-of-installed-packages-on-ubuntu-or-debian/?PageSpeed=noscript
but I think I'm running into the same problem. It seems the syntax has changed since 2007. The man page / help file seems to lead me to believe that the command should work



Usage: dpkg [<option> ...] <command>

--get-selections [<pattern> ...] Get list of selections to stdout.


but I get an error:



dpkg –get-selections samba
dpkg: error: need an action option


I found a few wuestions here that are related, but don't give me what I am looking for. I am interested in just knowing what's installed, but I guess that's a topic for another question.



  • What packages are installed by default in Debian? Is there a term for that set? Why some of those packages are `automatically installed` and some not?

  • How do we know what applications are installed in Linux?

  • Loop to check whether a Debian package is installed or not

  • Determine if a package is provided by an installed packagein Arch Linux






debian apt package-management dpkg






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:56









Community♦

1




1










asked Jul 19 '15 at 22:26









YetAnotherRandomUser

2321416




2321416











  • Are Raspban and Debian interchangeable? I would think not since Raspbian is specific to the Raspberry Pi and Debian probably can run on multiple hardware platforms.
    – YetAnotherRandomUser
    Jul 19 '15 at 22:49










  • Raspbian and Debian are not interchangeable, but Raspbian is a Debian derivative with the same package management mechanisms. The answers below using commands like apt-cache and dpkg apply equally to both (and to Ubuntu, Linux Mint, etc.)
    – Benjamin Staton
    Jul 11 '17 at 22:45
















  • Are Raspban and Debian interchangeable? I would think not since Raspbian is specific to the Raspberry Pi and Debian probably can run on multiple hardware platforms.
    – YetAnotherRandomUser
    Jul 19 '15 at 22:49










  • Raspbian and Debian are not interchangeable, but Raspbian is a Debian derivative with the same package management mechanisms. The answers below using commands like apt-cache and dpkg apply equally to both (and to Ubuntu, Linux Mint, etc.)
    – Benjamin Staton
    Jul 11 '17 at 22:45















Are Raspban and Debian interchangeable? I would think not since Raspbian is specific to the Raspberry Pi and Debian probably can run on multiple hardware platforms.
– YetAnotherRandomUser
Jul 19 '15 at 22:49




Are Raspban and Debian interchangeable? I would think not since Raspbian is specific to the Raspberry Pi and Debian probably can run on multiple hardware platforms.
– YetAnotherRandomUser
Jul 19 '15 at 22:49












Raspbian and Debian are not interchangeable, but Raspbian is a Debian derivative with the same package management mechanisms. The answers below using commands like apt-cache and dpkg apply equally to both (and to Ubuntu, Linux Mint, etc.)
– Benjamin Staton
Jul 11 '17 at 22:45




Raspbian and Debian are not interchangeable, but Raspbian is a Debian derivative with the same package management mechanisms. The answers below using commands like apt-cache and dpkg apply equally to both (and to Ubuntu, Linux Mint, etc.)
– Benjamin Staton
Jul 11 '17 at 22:45










4 Answers
4






active

oldest

votes

















up vote
9
down vote



accepted










apt-cache showpkg shows detailed information about potentially installable packages. It does indicate whether the package is installed, kind of, but not in a very readable way:



Versions:
2:3.6.6-6+deb7u5 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages)


If the package was installed, you'd see (/var/lib/dpkg/status) at the end of the line. However, this isn't fully reliable, because you'd also see this indication if the package was known to your system but not fully installed, e.g. if it was in the “package uninstalled but configuration files left over” state.



A more useful apt-cache subcommand is apt-cache policy. It clearly shows the installed version (if any) and the available version(s). For example, here's output from a machine which has samba installed but not samba-dev:



samba:
Installed: 2:4.1.17+dfsg-2
Candidate: 2:4.1.17+dfsg-2
Version table:
*** 2:4.1.17+dfsg-2 0
500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages
100 /var/lib/dpkg/status
samba-dev:
Installed: (none)
Candidate: 2:4.1.17+dfsg-2
Version table:
2:4.1.17+dfsg-2 0
500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages


Alternatively, you can use the dpkg command to get information about your current system. APT is the software that manages the download of packages, dependency analysis, etc. Dpkg is the low-level software that carries out the actual installation of a package file.



dpkg -l samba


This shows a line beginning with i if the package is installed, and a line beginning with u or p or nothing at all if the package is not installed.



$ dpkg -l samba samba-dev
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 samba 2:4.1.17+dfs amd64 SMB/CIFS file, print, and login s
dpkg-query: no packages found matching samba-dev


(dpkg-query is the dpkg subcommand that returns information about the package database.)



Note that if you just want to ensure that a package is installed, you can simply run



apt-get install samba


This won't do anything if the latest version of the package that's available in your distribution is already installed. It will install the package if it isn't installed yet, and it will upgrade it if you have an older version.






share|improve this answer



























    up vote
    5
    down vote













    dpkg -l | grep -e package1 -e package2 ....


    Will list packages you are interested with their current insstallation stauts. The output will be something like this



    bala@bala-laptop:~$ dpkg -l | grep apache2
    ii apache2 2.4.10-10 amd64 Apache HTTP Server


    The first 2 characters tell the status - ii here means
    First i - marked for installation
    Second i - Successfully installed



    There are other status codes like r meaning marked for removal, p meaning marked for purging etc.






    share|improve this answer




















    • +1 for power plus simplicity, and allowing partial matches if you don't know the exact package name. Partial in that dpkg -l|grep php might return php5, php5-cli, php5-common, etc.
      – Benjamin Staton
      Jul 11 '17 at 22:42










    • dpkg -l apache2 | grep '`^ii'
      – Corey Goldberg
      Sep 29 '17 at 3:37

















    up vote
    1
    down vote














    dpkg -l $PACKAGENAME




    is enough. The first two characters in the line will show the package status






    share|improve this answer




















    • specifically, the status ii means it is installed
      – Corey Goldberg
      Sep 29 '17 at 3:35

















    up vote
    1
    down vote













    aptitude show foo


    will show status of the pakage




    root@srv:# aptitude show python-jmespath
    Package: python-jmespath
    Version: 0.9.0-2
    State: not installed
    Priority: optional
    Section: python
    Maintainer: Debian Python Modules Team python-modules-team@lists.alioth.debian.org
    Architecture: all
    Uncompressed Size: 97.3 k
    Depends: python (>= 2.7)
    Description: JSON Matching Expressions (Python 2)
    JMESPath is python library which allows you to declaratively specify how to extract elements from a JSON document.

    This package contains the module for Python 2.
    Homepage: https://github.com/boto/jmespath


    root@cx-ops02:#





    share|improve this answer




















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f217076%2fhow-to-find-out-if-a-specific-package-is-installed-on-debian%23new-answer', 'question_page');

      );

      Post as a guest






























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      9
      down vote



      accepted










      apt-cache showpkg shows detailed information about potentially installable packages. It does indicate whether the package is installed, kind of, but not in a very readable way:



      Versions:
      2:3.6.6-6+deb7u5 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages)


      If the package was installed, you'd see (/var/lib/dpkg/status) at the end of the line. However, this isn't fully reliable, because you'd also see this indication if the package was known to your system but not fully installed, e.g. if it was in the “package uninstalled but configuration files left over” state.



      A more useful apt-cache subcommand is apt-cache policy. It clearly shows the installed version (if any) and the available version(s). For example, here's output from a machine which has samba installed but not samba-dev:



      samba:
      Installed: 2:4.1.17+dfsg-2
      Candidate: 2:4.1.17+dfsg-2
      Version table:
      *** 2:4.1.17+dfsg-2 0
      500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages
      100 /var/lib/dpkg/status
      samba-dev:
      Installed: (none)
      Candidate: 2:4.1.17+dfsg-2
      Version table:
      2:4.1.17+dfsg-2 0
      500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages


      Alternatively, you can use the dpkg command to get information about your current system. APT is the software that manages the download of packages, dependency analysis, etc. Dpkg is the low-level software that carries out the actual installation of a package file.



      dpkg -l samba


      This shows a line beginning with i if the package is installed, and a line beginning with u or p or nothing at all if the package is not installed.



      $ dpkg -l samba samba-dev
      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 samba 2:4.1.17+dfs amd64 SMB/CIFS file, print, and login s
      dpkg-query: no packages found matching samba-dev


      (dpkg-query is the dpkg subcommand that returns information about the package database.)



      Note that if you just want to ensure that a package is installed, you can simply run



      apt-get install samba


      This won't do anything if the latest version of the package that's available in your distribution is already installed. It will install the package if it isn't installed yet, and it will upgrade it if you have an older version.






      share|improve this answer
























        up vote
        9
        down vote



        accepted










        apt-cache showpkg shows detailed information about potentially installable packages. It does indicate whether the package is installed, kind of, but not in a very readable way:



        Versions:
        2:3.6.6-6+deb7u5 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages)


        If the package was installed, you'd see (/var/lib/dpkg/status) at the end of the line. However, this isn't fully reliable, because you'd also see this indication if the package was known to your system but not fully installed, e.g. if it was in the “package uninstalled but configuration files left over” state.



        A more useful apt-cache subcommand is apt-cache policy. It clearly shows the installed version (if any) and the available version(s). For example, here's output from a machine which has samba installed but not samba-dev:



        samba:
        Installed: 2:4.1.17+dfsg-2
        Candidate: 2:4.1.17+dfsg-2
        Version table:
        *** 2:4.1.17+dfsg-2 0
        500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages
        100 /var/lib/dpkg/status
        samba-dev:
        Installed: (none)
        Candidate: 2:4.1.17+dfsg-2
        Version table:
        2:4.1.17+dfsg-2 0
        500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages


        Alternatively, you can use the dpkg command to get information about your current system. APT is the software that manages the download of packages, dependency analysis, etc. Dpkg is the low-level software that carries out the actual installation of a package file.



        dpkg -l samba


        This shows a line beginning with i if the package is installed, and a line beginning with u or p or nothing at all if the package is not installed.



        $ dpkg -l samba samba-dev
        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 samba 2:4.1.17+dfs amd64 SMB/CIFS file, print, and login s
        dpkg-query: no packages found matching samba-dev


        (dpkg-query is the dpkg subcommand that returns information about the package database.)



        Note that if you just want to ensure that a package is installed, you can simply run



        apt-get install samba


        This won't do anything if the latest version of the package that's available in your distribution is already installed. It will install the package if it isn't installed yet, and it will upgrade it if you have an older version.






        share|improve this answer






















          up vote
          9
          down vote



          accepted







          up vote
          9
          down vote



          accepted






          apt-cache showpkg shows detailed information about potentially installable packages. It does indicate whether the package is installed, kind of, but not in a very readable way:



          Versions:
          2:3.6.6-6+deb7u5 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages)


          If the package was installed, you'd see (/var/lib/dpkg/status) at the end of the line. However, this isn't fully reliable, because you'd also see this indication if the package was known to your system but not fully installed, e.g. if it was in the “package uninstalled but configuration files left over” state.



          A more useful apt-cache subcommand is apt-cache policy. It clearly shows the installed version (if any) and the available version(s). For example, here's output from a machine which has samba installed but not samba-dev:



          samba:
          Installed: 2:4.1.17+dfsg-2
          Candidate: 2:4.1.17+dfsg-2
          Version table:
          *** 2:4.1.17+dfsg-2 0
          500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages
          100 /var/lib/dpkg/status
          samba-dev:
          Installed: (none)
          Candidate: 2:4.1.17+dfsg-2
          Version table:
          2:4.1.17+dfsg-2 0
          500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages


          Alternatively, you can use the dpkg command to get information about your current system. APT is the software that manages the download of packages, dependency analysis, etc. Dpkg is the low-level software that carries out the actual installation of a package file.



          dpkg -l samba


          This shows a line beginning with i if the package is installed, and a line beginning with u or p or nothing at all if the package is not installed.



          $ dpkg -l samba samba-dev
          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 samba 2:4.1.17+dfs amd64 SMB/CIFS file, print, and login s
          dpkg-query: no packages found matching samba-dev


          (dpkg-query is the dpkg subcommand that returns information about the package database.)



          Note that if you just want to ensure that a package is installed, you can simply run



          apt-get install samba


          This won't do anything if the latest version of the package that's available in your distribution is already installed. It will install the package if it isn't installed yet, and it will upgrade it if you have an older version.






          share|improve this answer












          apt-cache showpkg shows detailed information about potentially installable packages. It does indicate whether the package is installed, kind of, but not in a very readable way:



          Versions:
          2:3.6.6-6+deb7u5 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages)


          If the package was installed, you'd see (/var/lib/dpkg/status) at the end of the line. However, this isn't fully reliable, because you'd also see this indication if the package was known to your system but not fully installed, e.g. if it was in the “package uninstalled but configuration files left over” state.



          A more useful apt-cache subcommand is apt-cache policy. It clearly shows the installed version (if any) and the available version(s). For example, here's output from a machine which has samba installed but not samba-dev:



          samba:
          Installed: 2:4.1.17+dfsg-2
          Candidate: 2:4.1.17+dfsg-2
          Version table:
          *** 2:4.1.17+dfsg-2 0
          500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages
          100 /var/lib/dpkg/status
          samba-dev:
          Installed: (none)
          Candidate: 2:4.1.17+dfsg-2
          Version table:
          2:4.1.17+dfsg-2 0
          500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages


          Alternatively, you can use the dpkg command to get information about your current system. APT is the software that manages the download of packages, dependency analysis, etc. Dpkg is the low-level software that carries out the actual installation of a package file.



          dpkg -l samba


          This shows a line beginning with i if the package is installed, and a line beginning with u or p or nothing at all if the package is not installed.



          $ dpkg -l samba samba-dev
          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 samba 2:4.1.17+dfs amd64 SMB/CIFS file, print, and login s
          dpkg-query: no packages found matching samba-dev


          (dpkg-query is the dpkg subcommand that returns information about the package database.)



          Note that if you just want to ensure that a package is installed, you can simply run



          apt-get install samba


          This won't do anything if the latest version of the package that's available in your distribution is already installed. It will install the package if it isn't installed yet, and it will upgrade it if you have an older version.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 19 '15 at 22:43









          Gilles

          511k12010091540




          511k12010091540






















              up vote
              5
              down vote













              dpkg -l | grep -e package1 -e package2 ....


              Will list packages you are interested with their current insstallation stauts. The output will be something like this



              bala@bala-laptop:~$ dpkg -l | grep apache2
              ii apache2 2.4.10-10 amd64 Apache HTTP Server


              The first 2 characters tell the status - ii here means
              First i - marked for installation
              Second i - Successfully installed



              There are other status codes like r meaning marked for removal, p meaning marked for purging etc.






              share|improve this answer




















              • +1 for power plus simplicity, and allowing partial matches if you don't know the exact package name. Partial in that dpkg -l|grep php might return php5, php5-cli, php5-common, etc.
                – Benjamin Staton
                Jul 11 '17 at 22:42










              • dpkg -l apache2 | grep '`^ii'
                – Corey Goldberg
                Sep 29 '17 at 3:37














              up vote
              5
              down vote













              dpkg -l | grep -e package1 -e package2 ....


              Will list packages you are interested with their current insstallation stauts. The output will be something like this



              bala@bala-laptop:~$ dpkg -l | grep apache2
              ii apache2 2.4.10-10 amd64 Apache HTTP Server


              The first 2 characters tell the status - ii here means
              First i - marked for installation
              Second i - Successfully installed



              There are other status codes like r meaning marked for removal, p meaning marked for purging etc.






              share|improve this answer




















              • +1 for power plus simplicity, and allowing partial matches if you don't know the exact package name. Partial in that dpkg -l|grep php might return php5, php5-cli, php5-common, etc.
                – Benjamin Staton
                Jul 11 '17 at 22:42










              • dpkg -l apache2 | grep '`^ii'
                – Corey Goldberg
                Sep 29 '17 at 3:37












              up vote
              5
              down vote










              up vote
              5
              down vote









              dpkg -l | grep -e package1 -e package2 ....


              Will list packages you are interested with their current insstallation stauts. The output will be something like this



              bala@bala-laptop:~$ dpkg -l | grep apache2
              ii apache2 2.4.10-10 amd64 Apache HTTP Server


              The first 2 characters tell the status - ii here means
              First i - marked for installation
              Second i - Successfully installed



              There are other status codes like r meaning marked for removal, p meaning marked for purging etc.






              share|improve this answer












              dpkg -l | grep -e package1 -e package2 ....


              Will list packages you are interested with their current insstallation stauts. The output will be something like this



              bala@bala-laptop:~$ dpkg -l | grep apache2
              ii apache2 2.4.10-10 amd64 Apache HTTP Server


              The first 2 characters tell the status - ii here means
              First i - marked for installation
              Second i - Successfully installed



              There are other status codes like r meaning marked for removal, p meaning marked for purging etc.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jul 20 '15 at 5:59









              Balachandran Sivakumar

              511




              511











              • +1 for power plus simplicity, and allowing partial matches if you don't know the exact package name. Partial in that dpkg -l|grep php might return php5, php5-cli, php5-common, etc.
                – Benjamin Staton
                Jul 11 '17 at 22:42










              • dpkg -l apache2 | grep '`^ii'
                – Corey Goldberg
                Sep 29 '17 at 3:37
















              • +1 for power plus simplicity, and allowing partial matches if you don't know the exact package name. Partial in that dpkg -l|grep php might return php5, php5-cli, php5-common, etc.
                – Benjamin Staton
                Jul 11 '17 at 22:42










              • dpkg -l apache2 | grep '`^ii'
                – Corey Goldberg
                Sep 29 '17 at 3:37















              +1 for power plus simplicity, and allowing partial matches if you don't know the exact package name. Partial in that dpkg -l|grep php might return php5, php5-cli, php5-common, etc.
              – Benjamin Staton
              Jul 11 '17 at 22:42




              +1 for power plus simplicity, and allowing partial matches if you don't know the exact package name. Partial in that dpkg -l|grep php might return php5, php5-cli, php5-common, etc.
              – Benjamin Staton
              Jul 11 '17 at 22:42












              dpkg -l apache2 | grep '`^ii'
              – Corey Goldberg
              Sep 29 '17 at 3:37




              dpkg -l apache2 | grep '`^ii'
              – Corey Goldberg
              Sep 29 '17 at 3:37










              up vote
              1
              down vote














              dpkg -l $PACKAGENAME




              is enough. The first two characters in the line will show the package status






              share|improve this answer




















              • specifically, the status ii means it is installed
                – Corey Goldberg
                Sep 29 '17 at 3:35














              up vote
              1
              down vote














              dpkg -l $PACKAGENAME




              is enough. The first two characters in the line will show the package status






              share|improve this answer




















              • specifically, the status ii means it is installed
                – Corey Goldberg
                Sep 29 '17 at 3:35












              up vote
              1
              down vote










              up vote
              1
              down vote










              dpkg -l $PACKAGENAME




              is enough. The first two characters in the line will show the package status






              share|improve this answer













              dpkg -l $PACKAGENAME




              is enough. The first two characters in the line will show the package status







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jul 19 '15 at 22:31









              Marco d'Itri

              440311




              440311











              • specifically, the status ii means it is installed
                – Corey Goldberg
                Sep 29 '17 at 3:35
















              • specifically, the status ii means it is installed
                – Corey Goldberg
                Sep 29 '17 at 3:35















              specifically, the status ii means it is installed
              – Corey Goldberg
              Sep 29 '17 at 3:35




              specifically, the status ii means it is installed
              – Corey Goldberg
              Sep 29 '17 at 3:35










              up vote
              1
              down vote













              aptitude show foo


              will show status of the pakage




              root@srv:# aptitude show python-jmespath
              Package: python-jmespath
              Version: 0.9.0-2
              State: not installed
              Priority: optional
              Section: python
              Maintainer: Debian Python Modules Team python-modules-team@lists.alioth.debian.org
              Architecture: all
              Uncompressed Size: 97.3 k
              Depends: python (>= 2.7)
              Description: JSON Matching Expressions (Python 2)
              JMESPath is python library which allows you to declaratively specify how to extract elements from a JSON document.

              This package contains the module for Python 2.
              Homepage: https://github.com/boto/jmespath


              root@cx-ops02:#





              share|improve this answer
























                up vote
                1
                down vote













                aptitude show foo


                will show status of the pakage




                root@srv:# aptitude show python-jmespath
                Package: python-jmespath
                Version: 0.9.0-2
                State: not installed
                Priority: optional
                Section: python
                Maintainer: Debian Python Modules Team python-modules-team@lists.alioth.debian.org
                Architecture: all
                Uncompressed Size: 97.3 k
                Depends: python (>= 2.7)
                Description: JSON Matching Expressions (Python 2)
                JMESPath is python library which allows you to declaratively specify how to extract elements from a JSON document.

                This package contains the module for Python 2.
                Homepage: https://github.com/boto/jmespath


                root@cx-ops02:#





                share|improve this answer






















                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  aptitude show foo


                  will show status of the pakage




                  root@srv:# aptitude show python-jmespath
                  Package: python-jmespath
                  Version: 0.9.0-2
                  State: not installed
                  Priority: optional
                  Section: python
                  Maintainer: Debian Python Modules Team python-modules-team@lists.alioth.debian.org
                  Architecture: all
                  Uncompressed Size: 97.3 k
                  Depends: python (>= 2.7)
                  Description: JSON Matching Expressions (Python 2)
                  JMESPath is python library which allows you to declaratively specify how to extract elements from a JSON document.

                  This package contains the module for Python 2.
                  Homepage: https://github.com/boto/jmespath


                  root@cx-ops02:#





                  share|improve this answer












                  aptitude show foo


                  will show status of the pakage




                  root@srv:# aptitude show python-jmespath
                  Package: python-jmespath
                  Version: 0.9.0-2
                  State: not installed
                  Priority: optional
                  Section: python
                  Maintainer: Debian Python Modules Team python-modules-team@lists.alioth.debian.org
                  Architecture: all
                  Uncompressed Size: 97.3 k
                  Depends: python (>= 2.7)
                  Description: JSON Matching Expressions (Python 2)
                  JMESPath is python library which allows you to declaratively specify how to extract elements from a JSON document.

                  This package contains the module for Python 2.
                  Homepage: https://github.com/boto/jmespath


                  root@cx-ops02:#






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Aug 31 at 12:35









                  valch85

                  111




                  111



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f217076%2fhow-to-find-out-if-a-specific-package-is-installed-on-debian%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay