LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-08-2017, 12:05 PM   #1
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Better way to query packages on a RHEL system?


Working with RHEL 6.8 x86_64 and working to install 3rd party software.

I have to query the default install to confirm what packages are installed and if they are the correct version. I'm basically just typing this command this over and over:

Code:
rpm -qa | grep -i "insert package here" >> /tmp/output.txt
Say when I query Python, I got back more packages then I wanted, so I had to do some cleanup of output.txt file.

Is there a better way to go about doing this?

thanks
 
Old 05-08-2017, 12:16 PM   #2
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
yum list installed 'package'

I.E.

Code:
$ yum list installed 'php*'
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: centos.mirroring.pulsant.co.uk
 * epel: mirror.freethought-internet.co.uk
 * remi-php70: remi.mirror.wearetriple.com
 * remi-safe: remi.mirror.wearetriple.com
 * updates: mirror.sov.uk.goscomb.net
Installed Packages
php-cli.x86_64                                            7.0.11-1.el7.remi                                         @remi-php70
php-common.x86_64                                         7.0.11-1.el7.remi                                         @remi-php70
php-fpm.x86_64                                            7.0.11-1.el7.remi                                         @remi-php70
php-gd.x86_64                                             7.0.11-1.el7.remi                                         @remi-php70
php-imap.x86_64                                           7.0.11-1.el7.remi                                         @remi-php70
php-json.x86_64                                           7.0.11-1.el7.remi                                         @remi-php70
php-ldap.x86_64                                           7.0.11-1.el7.remi                                         @remi-php70
php-mysqlnd.x86_64                                        7.0.11-1.el7.remi                                         @remi-php70
php-opcache.x86_64                                        7.0.11-1.el7.remi                                         @remi-php70
php-pdo.x86_64                                            7.0.11-1.el7.remi                                         @remi-php70
php-xml.x86_64                                            7.0.11-1.el7.remi                                         @remi-php70
Giving no package name will return ALL installed packages.

Last edited by r3sistance; 05-08-2017 at 12:18 PM.
 
Old 05-08-2017, 07:56 PM   #3
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
A little better, however still have to manipulate it via cli to clean it up:


Code:
[root@server etc]# yum list installed 'python*'
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Installed Packages
python.x86_64                                                                          2.7.5-48.el7                                                         @rhui-REGION-rhel-server-releases
python-IPy.noarch                                                                      0.75-6.el7                                                           @anaconda/7.0
python-babel.noarch                                                                    0.9.6-8.el7                                                          @rhui-REGION-rhel-server-releases
python-backports.x86_64                                                                1.0-8.el7                                                            @rhui-REGION-rhel-server-releases
python-backports-ssl_match_hostname.noarch                                             3.4.0.2-4.el7                                                        @anaconda/7.0
python-caribou.noarch                                                                  0.4.16-1.el7                                                         @rhui-REGION-rhel-server-releases
python-chardet.noarch                                                                  2.0.1-7.el7                                                          @anaconda/7.0
python-chardet.noarch                                                                  2.2.1-1.el7_1                                                        installed
python-cheetah.x86_64                                                                  2.4.4-5.el7                                                          @koji-override-0/7.0
python-configobj.noarch                                                                4.7.2-7.el7                                                          @anaconda/7.0
python-dateutil.noarch                                                                 1.5-7.el7                                                            @anaconda/7.0
python-decorator.noarch                                                                3.4.0-3.el7                                                          @anaconda/7.0
python-dmidecode.x86_64                                                                3.10.13-11.el7                                                       @anaconda/7.0
python-ethtool.x86_64                                                                  0.8-5.el7                                                            @anaconda/7.0
python-gudev.x86_64                                                                    147.2-7.el7                                                          @anaconda/7.0
python-hwdata.noarch                                                                   1.7.3-4.el7                                                          @anaconda/7.0
python-iniparse.noarch                                                                 0.4-9.el7                                                            @anaconda/7.0
python-jinja2.noarch                                                                   2.7.2-2.el7                                                          @rhui-REGION-rhel-server-releases
python-jsonpatch.noarch                                                                1.2-2.el7                                                            @koji-override-0/7.0
python-jsonpointer.noarch                                                              1.9-2.el7                                                            @rhui-REGION-rhel-server-releases
python-kitchen.noarch                                                                  1.1.1-5.el7                                                          @anaconda/7.0
python-libs.x86_64                                                                     2.7.5-48.el7                                                         @rhui-REGION-rhel-server-releases
python-lxml.x86_64                                                                     3.2.1-4.el7                                                          @anaconda/7.0
python-magic.noarch                                                                    5.11-33.el7                                                          @rhui-REGION-rhel-server-releases
python-markdown.noarch                                                                 2.4.1-1.el7                                                          @epel
python-markupsafe.x86_64                                                               0.11-10.el7                                                          @rhui-REGION-rhel-server-releases
python-perf.x86_64                                                                     3.10.0-514.16.1.el7                                                  @rhui-REGION-rhel-server-releases
python-pillow.x86_64                                                                   2.0.0-19.gitd1c6db8.el7                                              @rhui-REGION-rhel-server-releases
python-prettytable.noarch                                                              0.7.2-1.el7                                                          @koji-override-0/7.0
python-pycurl.x86_64                                                                   7.19.0-19.el7                                                        @rhui-REGION-rhel-server-releases
python-pygments.noarch                                                                 1.4-9.el7                                                            @koji-override-0/7.0
python-pyudev.noarch                                                                   0.15-7.el7_2.1                                                       @rhui-REGION-rhel-server-releases
python-requests.noarch                                                                 2.6.0-1.el7_1                                                        @rhui-REGION-rhel-server-releases
python-rhsm.x86_64                                                                     1.17.9-1.el7                                                         @rhui-REGION-rhel-server-releases
python-rhsm-certificates.x86_64                                                        1.17.9-1.el7                                                         @rhui-REGION-rhel-server-releases
python-setuptools.noarch                                                               0.9.8-4.el7                                                          @rhui-REGION-rhel-server-releases
python-six.noarch                                                                      1.9.0-2.el7                                                          @rhui-REGION-rhel-server-releases
python-urlgrabber.noarch                                                               3.10-8.el7                                                           @rhui-REGION-rhel-server-releases
python-urllib3.noarch                                                                  1.5-8.el7                                                            @anaconda/7.0
python-urllib3.noarch                                                                  1.10.2-2.el7_1                                                       installed
python2-boto.noarch                                                                    2.45.0-3.el7                                                         @epel
python2-pyasn1.noarch                                                                  0.1.9-7.el7                                                          @rhui-REGION-rhel-server-releases
python2-rsa.noarch
 
Old 05-08-2017, 09:11 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,286

Rep: Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165
What do you expect ? - you used "-a" and a glob .... :sheesh:
If you want just (base) python use "python" in either rpm -q or dnf.

If you are running this a lot, a better idea might be to list the lot to a file and just use grep on that.
 
Old 05-08-2017, 09:22 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,797

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
In RHEL, there is a package "rpm-cron" that you can install. It will, daily, list all installed packages into file /var/log/rpmpkgs. Running grep on that file is quite fast.
 
Old 05-08-2017, 11:52 PM   #6
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
Quote:
yum list installed "*<partial_name>*"
For example, if you want to see available geany plugins you could run

Quote:
yum list "*geany*"
will show any packages, installed or not, with "geany" in the package name.

Last edited by Doug G; 05-08-2017 at 11:53 PM.
 
Old 05-09-2017, 12:55 AM   #7
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875
No solution for Redhat, but this is why I always end up back on debian. Basically I don't need to google to find things.

$ # find by filename
$ apt-file find file.h

$ # find by partial package name, even those NOT installed
$ dpkg-query --load-avail -l '*lib*sdl*'
$ # more current method of mostly the same
$ apt-cache search --names-only sdl | grep lib

$ # show specs on a package before you install it
$ apt-cache show alsa-utils

$ # show contents of a package, even those NOT installed
$ apt-file list devscripts
$ # same for the .deb file
$ dpkg -c package.deb

$ # or if you're curious and want to find things randomly with only one command
$ less /var/lib/dpkg/available
$ # although that requires dselect installed and dselect update
$ # to populate the mostly deprecated available file
 
Old 05-09-2017, 02:04 AM   #8
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,647

Rep: Reputation: 2655Reputation: 2655Reputation: 2655Reputation: 2655Reputation: 2655Reputation: 2655Reputation: 2655Reputation: 2655Reputation: 2655Reputation: 2655Reputation: 2655
i prefer
Code:
yum provides /usr/lib64/libgimp-2.0*
that will tell you WHAT package to install to get it
 
  


Reply

Tags
package, rhel6


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] A query about packages blacklist nyloc Slackware 7 06-14-2015 10:58 PM
Installation of packages in RHEL-5.3 using X windows menu Add/Remove packages akluthra Linux - Newbie 2 09-21-2010 06:34 AM
RHEL 5 - choosing packages for a minimal embedded system lqcaveman Linux - Newbie 1 05-06-2009 03:24 PM
how to show up all available packages in system-config-packages (RHEL 5) sean_zhang Linux - Newbie 1 03-10-2008 06:05 AM
system-config-packages doesnot work in RHEL 4 tuxfood Red Hat 0 12-13-2005 01:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration