Low Fat Linux

LINUX CLASSES - MANAGING LINUX

Which Linux Software Packages are Installed?

Querying Packages

RPM has a powerful query feature that allows you to find out what packages are installed on your system, the files associated with a package, or the package that owns a particular file. Use the -q flag to tell RPM to display the package name, version number, and release number of a package that's already installed, as in this example: rpm -q panda
panda-2.0-1

Here are some other flags you can use to specify the packages you want to query:

Flag Meanings

-a Queries all currently installed packages

-f somefile Queries the package that owns the specified file

-p packagefile Queries the specified package

And here are the flags you can use to control and format the information that your query returns:

Flag Meanings

-i Displays detailed package information such as name, description, release, size, build date, install date, and vendor

-l Displays all files associated with the package

-d Displays documentation and help files associated with the package

-c Displays configuration files associated with the package

-v Outputs file listings in the format of the ls -l command

Some Query Examples

You can combine the flags for the querying in may useful ways. Here are some examples.

To find out which package owns a file, enter

rpm -qf /usr/bin/panda
panda-2.0-1

To find the documentation that came with a package, enter

rpm -qd hotrod
/usr/man/man1/hotrod.1
/usr/info/hotrod.info.gz
/usr/doc/hotrod-1.0-1/README

To learn about a package before installing it, enter

rpm -qip hotrod-1.0-1.i386.rpm
Name : hotrod Distribution: Red Hat Linux
Version : 1.0 Vendor: Faster Software
Release : 1 Build Date: Sun Jul 04 14:35:27 1999
Install date: (none) Build Host: dev.faster.com
Group : Games Source RPM: hotrod-1.0-1.src.rpm
Size : 3141593
Summary : simulated hotrod racing game for SVGA
Description :
An action game that pits you against other maniacal drivers
on the Los Angeles freeway. Experience the thrill of road
rage as you attempt to get to work on time.

To see what files a package contains, enter

rpm -qlp hotrod-1.0-1.i386.rpm
/usr/man/man1/hotrod.1
/usr/info/hotrod.info.gz
/usr/doc/hotrod-1.0-1/README
/usr/lib/games/hotrodlib/cars.dat
/usr/lib/games/hotrodlib/drivers.dat
/usr/lib/games/hotrodlib/weapons.dat
/usr/lib/games/hotrodlib
/usr/games/hotrod

To find all installed packages that match a specific pattern, enter

rpm -qa | grep panda
panda-2.0-1
pandacalc-3.1-4
xpanda-1.2-3

Since the -q flag does accept a package name, you might wonder why we didn't use a command like this:

rpm -q panda*

This won't work because of the way the Bash shell treats wildcard characters, so we have to tell RPM to spit out all the installed package names and use grep to filter the list.

Finally, here's an advanced form of the query command that will tell you which packages are taking up the most room:

rpm -qa -queryformat='%{SIZE} %{NAME}' | sort -n

This command uses the -queryformat flag to specify that only the size and name information are to be printed for each package. The rpm output is piped to the sort command, which displays the package list sorted by size, from smallest to largest.





Verifying Packages

RPM includes a verify feature to help you identify problems with your installed packages. If you've deleted some files by accident or you think a file may have been corrupted, you can use the verify feature to find and fix the problem. RPM will compare the size, checksum, permissions, type, owner, and group information from its database against the files installed on your system and report any differences. Remember that RPM flags are case sensitive, so be sure to use a capital "V" when verifying, as in the examples shown here.

To verify a specific package, enter

rpm -V panda

To verify the package that contains a specific file, enter

rpm -Vf /usr/games/hotrod

To verify an installed package against the RPM package file, enter

rpm -Vp hotrod-1.0-1.i386.rpm

To verify all installed packages, enter

rpm -Va

If RPM finds no problems, there will be no output. If any problems are found, RPM will display a file name preceded by a string of eight characters. Each column of this string specifies whether or not there was a problem with a particular attribute of the file. If a period (.) appears in a column, there was no problem. If any of the characters in the following table appears, a problem related to that attribute occurred.

Column Code Explanation

1 5 MD5 checksum

2 S File size

3 L Symbolic link

4 T File modification time

5 D Device

6 U User

7 G Group

8 M Mode (read, write, and execution permissions and file type)

Here's an example showing that the checksum, size, and permissions are messed up for one of the man files in the hotrod package:

5S.....M /usr/man/man1/hotrod.1

If you see any output, you can remove and then reinstall the package, or you can fix the problem some other way if you know what to do.



Comments - most recent first
(Please feel free to answer questions posted by others!)

vbfkgbrl (09 Apr 2013, 13:27)
The business enterprise is publicly held and has its origins in Herzogenaurach, Germany. It was began by Adolf Dassler in 1924. Adidas is most famous for their sneakers, and they also manufacture sportswear, toiletries and sports activities routines equipment. it genuinely is thoroughly up to you. I would advise you begin putting on shoes if you should plan to carry out performances while in the long phrase. fully soft. if you transfer on to a lot more sophisticated procedures you want to get a sole that makes it potential to suit your needs to juggle together with your soles(soccer boots sucks when it will eventually come to sole methods). Personally I select turf footwear merely because just one you freestyle on concrete you will definitely put on the sole out, and a turf sole lasts longer. You might very well come across it just a little bit tougher to do sole juggles with turf footwear. but it actually is all about practice. When you've got any worries about your own personal health or the well being of your little one, you ought to invariably seek the advice of by using a physician or other healthcare specialist. Please analysis the Privacy Policy and Terms of Use in advance of using this internet site.
Sneakers for Football Freestyle

tylletext
pletchersgz (06 Apr 2013, 18:30)
{areliahalvebility,dhave tpurchase or #file_links<C>\website\1\Home\now1.txt,1,N] sell,purchase and sell,sell or buy,enter a trade,sell or purchasehe abilitimpulsesy to,finhowever,alternatively,conversely,in contrastd a way to,be capable of,seem to,dopraised,arecaterer #file_links<C>\website\1\Home\ping2.txt,1,N] no #file_links<C>\website\1\Home\ping3.txt,1,N] #file_links<C>\website\1\Home\ping4.txt,1,N] more #file_links<C>\website\1\Home\ping1.txt,1,N] thanhickormust know,need to knowwith a goodyswithstandprayershort stayhated servicedmanned apartmentsable to,often,try to,can,be able to,be puppy,canine,your canine,your pet,pet,doggy,your puppyrouriteapprovalady to,almo stimprisoned always,getover-stated to ,alloaudited,oyears #file_links<C>\website\1\Home\home.txt,1,N] ofbservedw you to,be capable to,have the capacity toependability,credgate ibadverse reactionsilof discussiolast a long timenity,stabilitygone to,believability,standing,credibleness family member,a relatrfinancial obligations,bad debts,debt,obligationsied totive∽â•♫¥appalcohol consumption,having a drinkointed,peddlinglpretending to beabeled⊙ï¹isles⊙retail center,retail complex,local mall,nearby mall,shopping center  ゜︶what are〖〖♬

Our updates Recent articles:
jaya krishna (16 Aug 2012, 17:38)
hi bob
while installing repo in redhat im using (rpm -ivh createrepo) command even my tutorial sir is not informing me what -ivh really mean. can u kindly give me information on repo creation and command purpose. i have searched google for -ivh but could not find it.
Joe Wulf (05 Apr 2012, 23:43)
How does one refine or specify the format for "%{INSTALLTIME:date}"?

I get the first or second response for unknown reasons:
- "Fri 10 Jun 2011 02:03:18 PM GMT"
- "Fri 10 June 02:03:18 2011"

I would prefer to define a format that I like and specifically always use it. The first one works best for me. How can I always get that?

Thank you.

Bob Rankin (09 Mar 2012, 08:45)
@Manish - Those are not questions, they're Linux commands. If you want to know what they do, continue reading here.
manish (09 Mar 2012, 05:25)
pl help to ans these questions?
1. rpm -e "package name"?

2. Vi -x "file name"?

3. Userdel -r üsername"?

4.Is -l?
manjunath (06 Feb 2012, 12:38)
i like built own redhat package.what are the basic steps to be followed to create rpm
colin slater (31 Jan 2012, 09:52)
Is there a way to find out when a RHEL5 server was originally built?
sunil (12 Jan 2012, 02:36)
i need a command to list recently installed 5 packages
frank (04 Jan 2012, 02:43)
Hi bob,

can a local user query for installed package..
if not can he do it by sudo access?

ravi (03 Oct 2011, 07:13)
Hi Bob,
I have 2 queries
1) How do I unpack/extract a rpm package without installing it.
2)How do I query file attributes of file in a rpm package without installing it.

Awaiting your response !
Ravi
Mohammed (25 Sep 2011, 01:22)
Honestly I want to be very grateful to you for all the kindness.You're truly blessed and willingly share your knowledge with humanity.God bless you each moment,each day someone reads your work.The tutorial is good and very good for beginners.PLEASE DO YOU RUN CERTIFICATE CLASSES?.Thank you the more
Port Forward Podcast (18 Aug 2011, 16:13)
Hey Bob,
Great post. For suse I found that I had to modify the sort by size command a little bit for it to work right:

rpm -qa --queryformat='%{SIZE} %{NAME}\n' | sort -n

Thanks again!
Regards,
Port Forward Podcast
manabjyoti (11 Oct 2010, 05:30)
Hi Bob,

while tryin to instal a package I got some dependencies error that it need some file. But I want to know in which pachage I got those files???

ex: libgdkglext-x11-1.0.so.0(64bit)
libgts-0.7.so.5()(64bit)

thanks in advance...

regards,
manab
yo (29 Sep 2010, 11:38)
My order is coming out different:
SM5.L..T c /etc/sysconfig/rhn/up2date

You can edit with what every you wish, but vi is the fallback editor for when you are trying to repair a system crash and is static linked and in sbin. Other editors might not be working in extreme conditions so a bit of vi knowledge is good.

EMACS is just evil though.
shruti singh (03 Aug 2010, 01:24)
i have installed fedora 12, only os in my system is fedora, and it's not comp[iling, so for that i need to install vim editor rpm files, which package i should install
Ron (23 Jun 2010, 08:32)
Is there a way to query to see if a newer rpm than a given rpm is already installed on a system or not? That would be helpful in checking to see if a system's set of installed rpms exceeds (or is equal to) a minimum. For instance, if I'm checking for
rpmname-versionB-release1
and the system has
rpmname-versionC-release2
that would pass the test, but the check would fail if the system has
rpmname-versionA-release0

Is there way to check that easily or do I have to write some elaborate script to decypher?

thanks.

Ron
prakash (09 Mar 2010, 22:44)
Hi Bob

What is the command to find the dependencies of a rpm package..?
msmarystrikens (27 Feb 2010, 11:28)
Hi! I really liked your forum, especially this section. I just signed up and immediately decided to introduce myself, if I'm wrong section, ask the moderators to move the topic to the right place, hopefully it will take me well... My name is Mary, me 29 years, humourist and serious woman in one person. I apologize for my English
Ken (03 Feb 2010, 15:18)
Thanks for all the great info Bob. After a month, I've finally gotten through your entire site and I'm finally confident to make my way around Linux for day to day tasks. You rock!
Bob Rankin (25 Jan 2010, 12:25)
Rex, Probably easiest if you query for something like "newsgroup reader for Fedora linux". As for vi/vim, you won't need to use a line editor like that if you have a graphical desktop with Gnote or similar.
Rex Welsh (25 Jan 2010, 11:02)
Hello Doctor Bob

My youngest son installed Fedora 12 over XP on my computers. I now have a lot to learn and have to do so as if I'm learning to speak again. The trouble is finding where to hunt for the knowledge.

I looked for a newsgroup reader and found a few that might work. The trouble arose when I saw that there were a lot of files listed for different systems. Debian was one. There were others too. Could you add to your tutorial about how to navigate through this morass of data?

A second comment is why can't a person use gnote or gedit in place of Vi or Vim?

Thanks for providing a place to learn.

Rex Welsh

I welcome your comments. However... I am puzzled by many people who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn all you can, ask questions if you like. But don't ask me to send what you already have. :-)

NO SPAM! If you post garbage, it will be deleted, and you will be banned.
*Name:
Email:
Notify me about new comments on this page
Hide my email
*Text:


Ask Bob Rankin - Free Tech Support


Copyright © by -
All rights reserved - Redistribution is allowed only with permission.