Question: What is the linux command to list the files from rpm package without extracting ?
Answer : To do listing of files from rpm file package we will use rpm2cpio and cpio command.

It is good practice to check list of files before extracting files from rpm package.
By viewing list of files we can select the particular file name to be extracted out from rpm package.

To list the files from rpm package

Use below given command to list the files from rpm package.Here, -t option with cpio command is for listing the files from archive.

Syntax:

rpm2cpio package-name.rpm |cpio -t

In below given example,we have listed the files from vsftpd-2.2.2-6.el6.i686.rpm package

[root@localhost ~]# rpm2cpio vsftpd-2.2.2-6.el6.i686.rpm |cpio -t
./etc/logrotate.d/vsftpd
./etc/pam.d/vsftpd
./etc/rc.d/init.d/vsftpd
./etc/vsftpd
./etc/vsftpd/ftpusers
./etc/vsftpd/user_list
./etc/vsftpd/vsftpd.conf
./etc/vsftpd/vsftpd_conf_migrate.sh
./usr/sbin/vsftpd
./usr/share/doc/vsftpd-2.2.2
./usr/share/doc/vsftpd-2.2.2/AUDIT
./usr/share/doc/vsftpd-2.2.2/BENCHMARKS
./usr/share/doc/vsftpd-2.2.2/BUGS
./usr/share/doc/vsftpd-2.2.2/COPYING
./usr/share/doc/vsftpd-2.2.2/Changelog
./usr/share/doc/vsftpd-2.2.2/EXAMPLE
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/README
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/README.configuration
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/vsftpd.conf
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/vsftpd.xinetd
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/README
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/README.configuration
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/README
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/README.configuration
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/hosts.allow
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/README
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_HOSTS
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_HOSTS/README
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/README
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/README.configuration
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/logins.txt
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/vsftpd.conf
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/vsftpd.pam
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS_2
./usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS_2/README
./usr/share/doc/vsftpd-2.2.2/FAQ
./usr/share/doc/vsftpd-2.2.2/INSTALL
./usr/share/doc/vsftpd-2.2.2/LICENSE
./usr/share/doc/vsftpd-2.2.2/README
./usr/share/doc/vsftpd-2.2.2/README.security
./usr/share/doc/vsftpd-2.2.2/REWARD
./usr/share/doc/vsftpd-2.2.2/SECURITY
./usr/share/doc/vsftpd-2.2.2/SECURITY/DESIGN
./usr/share/doc/vsftpd-2.2.2/SECURITY/IMPLEMENTATION
./usr/share/doc/vsftpd-2.2.2/SECURITY/OVERVIEW
./usr/share/doc/vsftpd-2.2.2/SECURITY/TRUST
./usr/share/doc/vsftpd-2.2.2/SIZE
./usr/share/doc/vsftpd-2.2.2/SPEED
./usr/share/doc/vsftpd-2.2.2/TODO
./usr/share/doc/vsftpd-2.2.2/TUNING
./usr/share/doc/vsftpd-2.2.2/vsftpd.xinetd
./usr/share/man/man5/vsftpd.conf.5.gz
./usr/share/man/man8/vsftpd.8.gz
./var/ftp
./var/ftp/pub
706 blocks
[root@localhost ~]# 

Read Some More Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.