LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 07-17-2013, 05:08 AM   #1
Akhran
Member
 
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Rep: Reputation: 30
YUM Search Result - How to tell if any of the listed packages are installed?


Debian Aptitude show command has a 'i' next to the package name if it is already installed.

Just wondering if there is a similar indicator or to that effect from the result of 'yum search' result.

Thanks!
 
Old 07-17-2013, 06:17 AM   #2
davidov31
LQ Newbie
 
Registered: Aug 2011
Location: Melbourne, Australia
Distribution: CentOS
Posts: 4

Rep: Reputation: Disabled
Do you need to see a list of packages installed on your system?

yum list installed
 
Old 07-17-2013, 06:42 AM   #3
Akhran
Member
 
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Original Poster
Rep: Reputation: 30
Eg. I would like to (1) search for packages related to 'font' and also (2) to know if they are already installed in the system. So I did a 'yum search font' with part of the results as shown below. Objective (1) is achieved, but to know if each of these packages are installed, I would need to do a 'yum listed <package name>' for each of the package listed in the result. Is there a more efficient way?

Thanks again !


xorg-x11-fonts-100dpi.noarch : A set of 100dpi resolution fonts for the X Window System.
xorg-x11-fonts-75dpi.noarch : A set of 75dpi resolution fonts for the X Window System.
xorg-x11-fonts-ISO8859-1-100dpi.noarch : A set of 100dpi ISO-8859-1 fonts for X.
xorg-x11-fonts-ISO8859-1-75dpi.noarch : A set of 75dpi ISO-8859-1 fonts for X.
xorg-x11-fonts-ISO8859-14-100dpi.noarch : ISO8859-14-100dpi fonts
xorg-x11-fonts-ISO8859-14-75dpi.noarch : ISO8859-14-75dpi fonts
xorg-x11-fonts-ISO8859-15-100dpi.noarch : ISO8859-15-100dpi fonts
xorg-x11-fonts-ISO8859-15-75dpi.noarch : ISO8859-15-75dpi fonts
xorg-x11-fonts-ISO8859-2-100dpi.noarch : A set of 100dpi Central European language fonts for X.
xorg-x11-fonts-ISO8859-2-75dpi.noarch : A set of 75dpi Central European language fonts for X.
xorg-x11-fonts-ISO8859-9-100dpi.noarch : ISO8859-9-100dpi fonts
xorg-x11-fonts-ISO8859-9-75dpi.noarch : ISO8859-9-75dpi fonts
xorg-x11-fonts-Type1.noarch : Type1 fonts provided by the X Window System
xorg-x11-fonts-cyrillic.noarch : Cyrillic fonts for X.
xorg-x11-fonts-ethiopic.noarch : Ethiopic fonts
xorg-x11-fonts-misc.noarch : misc bitmap fonts for the X Window System


Quote:
Originally Posted by davidov31 View Post
Do you need to see a list of packages installed on your system?

yum list installed
 
Old 07-17-2013, 07:01 AM   #4
davidov31
LQ Newbie
 
Registered: Aug 2011
Location: Melbourne, Australia
Distribution: CentOS
Posts: 4

Rep: Reputation: Disabled
You can take the results of the first command I suggested
Code:
sudo yum list installed
and rather than displaying the full list on your screen you can pipe the results into a second command,
Code:
grep fonts
which will then show you only the installed packages on your system with the text string "fonts" in the package name

So the full command is

Code:
sudo yum list installed | grep fonts

Last edited by davidov31; 07-17-2013 at 07:02 AM.
 
Old 07-17-2013, 07:27 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
I'm not sure if this can be done by using only yum and its options.

You can write a one-liner to mimic the aptitude behaviour:
Code:
yum info *fonts* | awk -F: '/^Name/ { printf $2} /^Repo/ { if ($2 == " installed") { printf " (installed) " } else { printf ""}} /^Summary/ { print $2 }'
The above is based on the output of yum info <string> and only shows those fields you want/need.

The above shows the package name, followed by installed (or empty if not) and the summary. One line per found package.

Output would look something like this (using *system-config* to show both entries possible) :
Code:
 system-config-firewall-tui (installed)  A text interface for basic firewall setup
 system-config-network-tui (installed)  The Network Adminstration Tool
 system-config-date A graphical interface for modifying system date and time
 system-config-date-docs Documentation for setting the system date and time

Last edited by druuna; 07-17-2013 at 07:28 AM.
 
Old 07-17-2013, 07:45 AM   #6
davidov31
LQ Newbie
 
Registered: Aug 2011
Location: Melbourne, Australia
Distribution: CentOS
Posts: 4

Rep: Reputation: Disabled
Ah right, looks like I mis-read the OP slightly, apologies!
 
Old 07-17-2013, 04:46 PM   #7
Akhran
Member
 
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Original Poster
Rep: Reputation: 30
Thanks guys for the helpful posts. If only 'Yum search' has those information displayed by default, or with an option...
 
  


Reply



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
packages returned by yum search are not available joe2748 Linux - Software 5 02-23-2012 05:26 AM
yum and packagekit - list installed packages and dependencies allele Linux - Newbie 2 06-24-2009 03:31 PM
Yum update conflicts when there is both i386 and x86_64 rpm packages installed. zimon Fedora 2 10-09-2008 06:30 AM
yum unable to detect the installed packages ? gopiindiaever Linux - Software 3 09-18-2006 02:24 AM
Find location of packages previously installed with yum on fedora core 5 Tails and Link Linux - Newbie 8 04-30-2006 04:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 09:19 PM.

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