Home

1. Use full RPM commands (Notes and FAQ)

This FAQ list some use full RPM commands.

1.1. Querying installed package
Q: What is RPM?
Q: How will I list all the package install on my OS?
Q: How will I display page information?
Q: How will I list the installed patch?
Q: How do I list all rpm data base files?
Q: How you check the package dependency?
Q: How will I display only document files?
Q: How do I see the install scripts( Pre-Install, Post-Intall, etc)?
1.2. Querying existing RPM file
Q: How will I list all files from rpm package?
Q: How will I extract single file from RPM package?
Q: How will I extract all file from RPM package?

1.1. Querying installed package

Q:

What is RPM?

A:

RPM is Redhat Package Manager, It is used to manage the software package on Linux and some Unix Operating System.

Q:

How will I list all the package install on my OS?

A:

Use the following command:

		 
	rpm -qa
		  
		 

Sample Ouput:

		
	aaa_skel-2003.9.18-93
	terminfo-5.4-59
	libgcc-3.3.3-41
	gpart-0.1h-475
	mktemp-1.5-729
	ncurses-5.4-59
	patch-2.5.9-141
	lukemftp-1.5-578
		
		

Q:

How will I display page information?

A:

Use the following command:

		 
    rpm -q -i rsh
		  
		 

Sample Ouput:

		
    # rpm -q -i rsh
    Name        : rsh                          Relocations: (not relocatable)
    Version     : 0.17                              Vendor: SuSE Linux AG, Nuernberg, Germany
    Release     : 548                           Build Date: Mon Apr  5 21:49:44 2004
    Install date: Wed Apr 21 07:11:50 2004      Build Host: welles.suse.de
    Group       : Productivity/Networking/Other   Source RPM: rsh-0.17-548.src.rpm
    Size        : 61051                            License: BSD
    Signature   : DSA/SHA1, Mon Apr  5 21:54:39 2004, Key ID a84edae89c800aca
    Packager    : http://www.suse.de/feedback
    URL         : ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/
    Summary     : Clients for remote access commands (rsh, rlogin, and rcp)
    Description :
    This package contains programs that allow users to run commmands on
    remote machines, to log in to other machines, and to copy files between
    machines (rsh, rexec, rlogin, and rcp).  These commands use rhosts
    style authentication. For secure communication, SSH should be used.
    Distribution: SuSE Linux 9.1 (i586)
		
		

Q:

How will I list the installed patch?

A:

Use the following command:

          
   rpm -qPa 
          
          

Sample Output:

		
    # rpm -qPa
    no patch-rpm installed
		
		

Q:

How do I list all rpm data base files?

A:

Use the following command:

	    
   rpm -q -a -l
          
          

Sample Output:

	     
    # rpm -q -a -l
    /usr/share/terminfo/n/nwp512
    /usr/share/terminfo/n/nwp512-a
    /usr/share/terminfo/n/nwp512-o
		
	    

[Warning]Warning

This command will produce lot of output, some time it will take long time.

You can store the output into file or pipe. rpm -q -a -l |more

Q:

How you check the package dependency?

A:

Use the following command:

	    
    rpm -q --whatrequires less
          
          

Sample Output:

	    
    # rpm -q --whatrequires less
    man-2.4.1-209
	    
	    

Q:

How will I display only document files?

A:

Use the following command:

	    
    rpm -qd rsh
          
          

Sample Output:

	    
	     # rpm -qd rsh
	    /usr/share/doc/packages/rsh/BUGS
	    /usr/share/doc/packages/rsh/ChangeLog
	    /usr/share/man/man1/rcp.1.gz
	    /usr/share/man/man1/rexec.1.gz
	    /usr/share/man/man1/rlogin.1.gz
	    /usr/share/man/man1/rsh.1.gz
	    /usr/share/man/man5/rhosts.5.gz
	    
	    

[Note]Note

You can use GNU style command line optione also. so, use the rpm -q --docfiles rpm command. su.

Q:

How do I see the install scripts( Pre-Install, Post-Intall, etc)?

A:

Use the following command:

	    
     rpm -q --scripts 
          
          

Sample Output:

	    
    rpm -q --scripts RealPlayer
    preinstall scriptlet (through /bin/sh):
    # Remove file from old versions.
    rm -f /usr/lib/RealPlayer8/mimeinstall.log
          
          

1.2. Querying existing RPM file

Q:

How will I list all files from rpm package?

A:

Use the following command:

	    
     rpm -qpl  xmlto-0.0.18-0.i586.rpm
          
          

Sample Output:

          
    /usr/bin/xmlif
    /usr/bin/xmlto
    /usr/share/man/man1/xmlif.1.gz
    /usr/share/man/man1/xmlto.1.gz
    /usr/share/xmlto
    /usr/share/xmlto/format
    /usr/share/xmlto/format/docbook
          
	

Q:

How will I extract single file from RPM package?

A:

Use the following command:

	    
     rpm2cpio {fullpackagename} | cpio -idv {FullnameOfFileToGet}
          
          

Sample Output:

	    
    # rpm2cpio  xmlto-0.0.18-0.i586.rpm | cpio -idv  ./usr/share/xmlto/format/fo/dvi
    ./usr/share/xmlto/format/fo/dvi
    100 blocks
          
	   

Q:

How will I extract all file from RPM package?

A:

Use the following command:

	    
     rpm2cpio {fullpackagename} | cpio -idv
          
          

Sample Output:

	    
    # rpm2cpio  xmlto-0.0.18-0.i586.rpm | cpio -idv  
    ./usr/bin/xmlif
    ./usr/bin/xmlto
    ./usr/share/man/man1/xmlif.1.gz
    ./usr/share/man/man1/xmlto.1.gz
    ./usr/share/xmlto
    ./usr/share/xmlto/format
    ./usr/share/xmlto/format/docbook
    ./usr/share/xmlto/format/docbook/dvi
    ./usr/share/xmlto/format/docbook/fo
    ./usr/share/xmlto/format/fo/dvi
    100 blocks