LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do I know if a package/list of package is installed (http://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-know-if-a-package-list-of-package-is-installed-723341/)

redhatwannabe 05-03-2009 01:13 PM

How do I know if a package/list of package is installed
 
Hi,

How do I know if a package/list of package is installed?

is it rpm -q -qf?

or is there other commands as well? thanks

Tinkster 05-03-2009 01:49 PM

What does your man page say about -qf ?

Mine suggests that it queries which package the file
given as an argument to -qf belongs to; so that would
make the answer to
Quote:

is it rpm -q -qf?
a no.



Cheers,
Tink

lazlow 05-03-2009 03:19 PM

It always helps if you tell us the distro, version, and arch you are running.

On yum based distros 'yum info package' will get the job done.

tommylovell 05-03-2009 04:30 PM

I'm assuming Redhat or Fedora. If you are restricted to the command line, then use rpm or Yum (yum not available on real old versions of Redhat). If in a graphical environment, install Yumex ('yum install yumex').

rpm -qa | grep <partofpackagename>
rpm -qa <package or package wildcard>

These are also helpful to give you info on specific packages:
rpm -qi <package>
rpm -ql <package>

A few examples:
Code:

[root@athlonz ~]# rpm -qa | grep gcc
gcc-gfortran-4.3.0-8.x86_64
libgcc-4.3.0-8.x86_64
gcc-c++-4.3.0-8.x86_64
gcc-4.3.0-8.x86_64
libgcc-4.3.0-8.i386

[root@athlonz ~]# rpm -qa | grep grep
grep-2.5.1-59.fc9.x86_64

[root@athlonz ~]# rpm -qa gcc
gcc-4.3.0-8.x86_64

[root@athlonz ~]# rpm -qa gcc gcc-gfortran grep
grep-2.5.1-59.fc9.x86_64
gcc-gfortran-4.3.0-8.x86_64
gcc-4.3.0-8.x86_64

[root@athlonz ~]# rpm -qa gcc* gre*
grep-2.5.1-59.fc9.x86_64
gcc-gfortran-4.3.0-8.x86_64
gcc-c++-4.3.0-8.x86_64
gcc-4.3.0-8.x86_64

[root@athlonz ~]# rpm -qi gcc* gre*
package gcc* is not installed
package gre* is not installed

[root@athlonz ~]# rpm -qi gcc
Name        : gcc                          Relocations: (not relocatable)
Version    : 4.3.0                            Vendor: Fedora Project
Release    : 8                            Build Date: Mon 28 Apr 2008 05:07:29 PM EDT
Install Date: Tue 10 Mar 2009 07:15:06 AM EDT      Build Host: hammer2.fedora.redhat.com
Group      : Development/Languages        Source RPM: gcc-4.3.0-8.src.rpm
Size        : 17793711                        License: GPLv3+ and GPLv2+ with exceptions
Signature  : DSA/SHA1, Tue 29 Apr 2008 10:03:16 AM EDT, Key ID b44269d04f2a6fd2
Packager    : Fedora Project
URL        : http://gcc.gnu.org
Summary    : Various compilers (C, C++, Objective-C, Java, ...)
Description :
The gcc package contains the GNU Compiler Collection version 4.3.
You'll need this package in order to compile C code.

[root@athlonz ~]# rpm -ql gcc
/usr/bin/c89
/usr/bin/c99
/usr/bin/cc
/usr/bin/gcc
/usr/bin/gcov
/usr/bin/protoize
/usr/bin/unprotoize
/usr/bin/x86_64-redhat-linux-gcc
/usr/lib/gcc
/usr/lib/gcc/x86_64-redhat-linux
...


tommylovell 05-03-2009 04:46 PM

And as suggested by lazlow, 'yum info package' (if you have yum repositories - we didn't have them until quite recently in work.)

Code:

[root@athlonz ~]# yum info gcc* grep
Loaded plugins: refresh-packagekit
Installed Packages
Name      : gcc
Arch      : x86_64
Version    : 4.3.0
Release    : 8
Size      : 17 M
Repo      : installed
Summary    : Various compilers (C, C++, Objective-C, Java, ...)
URL        : http://gcc.gnu.org
License    : GPLv3+ and GPLv2+ with exceptions
Description: The gcc package contains the GNU Compiler Collection version 4.3.
          : You'll need this package in order to compile C code.

Name      : gcc-c++
Arch      : x86_64
Version    : 4.3.0
Release    : 8
Size      : 9.6 M
Repo      : installed
Summary    : C++ support for GCC
URL        : http://gcc.gnu.org
License    : GPLv3+ and GPLv2+ with exceptions
Description: This package adds C++ support to the GNU Compiler Collection.
          : It includes support for most of the current C++ specification,
          : including templates and exception handling.

Name      : gcc-gfortran
Arch      : x86_64
Version    : 4.3.0
Release    : 8
Size      : 11 M
Repo      : installed
Summary    : Fortran 95 support
URL        : http://gcc.gnu.org
License    : GPLv3+ and GPLv2+ with exceptions
Description: The gcc-gfortran package provides support for compiling Fortran 95
          : programs with the GNU Compiler Collection.

Name      : grep
Arch      : x86_64
Version    : 2.5.1
Release    : 59.fc9
Size      : 454 k
Repo      : installed
Summary    : The GNU versions of grep pattern matching utilities
URL        : http://www.gnu.org/software/grep/
License    : GPL
Description: The GNU versions of commonly used grep utilities.  Grep searches
          : through textual input for lines which contain a match to a specified
          : pattern and then prints the matching lines.  GNU's grep utilities
          : include grep, egrep and fgrep.
          :
          : You should install grep on your system, because it is a very useful
          : utility for searching through text.

Available Packages
Name      : gcc-gnat
Arch      : x86_64
Version    : 4.3.0
Release    : 8
Size      : 13 M
Repo      : fedora
Summary    : Ada 95 support for GCC
URL        : http://gcc.gnu.org
License    : GPLv3+ and GPLv2+ with exceptions
Description: GNAT is a GNU Ada 95 front-end to GCC. This package includes development tools,
          : the documents and Ada 95 compiler.

Name      : gcc-java
Arch      : x86_64
Version    : 4.3.0
Release    : 8
Size      : 3.3 M
Repo      : fedora
Summary    : Java support for GCC
URL        : http://gcc.gnu.org
License    : GPLv3+ and GPLv2+ with exceptions
Description: This package adds support for compiling Java(tm) programs and
          : bytecode into native code.

Name      : gcc-objc
Arch      : x86_64
Version    : 4.3.0
Release    : 8
Size      : 3.3 M
Repo      : fedora
Summary    : Objective-C support for GCC
URL        : http://gcc.gnu.org
License    : GPLv3+ and GPLv2+ with exceptions
Description: gcc-objc provides Objective-C support for the GCC.
          : Mainly used on systems running NeXTSTEP, Objective-C is an
          : object-oriented derivative of the C language.

Name      : gcc-objc++
Arch      : x86_64
Version    : 4.3.0
Release    : 8
Size      : 3.5 M
Repo      : fedora
Summary    : Objective-C++ support for GCC
URL        : http://gcc.gnu.org
License    : GPLv3+ and GPLv2+ with exceptions
Description: gcc-objc++ package provides Objective-C++ support for the GCC.


knudfl 05-04-2009 01:57 AM

  • The Package list :
  • rpm -qa | sort > my_installed_packages.txt


All times are GMT -5. The time now is 08:59 PM.