dpkg -s
ファイルやプログラムではなく、パッケージ名を引数として取ります。(多くの場合、プログラムはそれを提供するパッケージと同じ名前になります。)
たとえば、私の Ubuntu システムでは、次のように表示されdpkg -s gcc
ます。
Package: gcc
Status: install ok installed
Priority: optional
Section: devel
Installed-Size: 64
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: i386
Source: gcc-defaults (1.98ubuntu3)
Version: 4:4.5.2-1ubuntu3
Provides: c-compiler
Depends: cpp (>= 4:4.5.2-1ubuntu3), gcc-4.5 (>= 4.5.2-1~)
Recommends: libc6-dev | libc-dev
Suggests: gcc-multilib, make, manpages-dev, autoconf, automake1.9, libtool, flex, bison, gdb, gcc-doc
Conflicts: gcc-doc (<< 1:2.95.3)
Description: The GNU C compiler
This is the GNU C compiler, a fairly portable optimizing compiler for C.
.
This is a dependency package providing the default GNU C compiler.
Original-Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
CentOS システムでは、以下をrpm -q gcc
出力します。
gcc-4.1.2-50.el5
それほど多くの情報は表示されませんが、パッケージがインストールされているかどうかを確認するだけであれば問題ありません。さらに詳しい情報やその他のオプションが必要な場合は、man rpm
; 他のクエリが利用可能です。
が表示される場合rpm -q snmpd
はpackage snmpd is not installed
、おそらく必要な情報です。
両方とも、それに応じて終了ステータスdpkg -s
をrpm -q
設定し、パッケージがインストールされていない場合は失敗を報告します。