As far I know, there are 3 ways available to list the files inside a RPM and they are as follows:
To list only files:
# rpm -qlp packagename.rpm
To list files with permission with ownership:
# rpm2cpio packagename.rpm | cpio -tv
To list files with detailed description about the RPM:
# less packagename.rpm
Next to extract a file from a RPM, we can again use the 'rpm2cpio' command along with 'cpio' with different switches as shown as follows:
[root@hostxyx tmp]# rpm2cpio packagename.rpm | cpio -idvm
./etc/blkid
./etc/mke2fs.conf
./sbin/badblocks
./sbin/blkid
./sbin/debugfs
./sbin/dumpe2fs
./sbin/e2image
./sbin/fsck
./sbin/logsave
./sbin/resize2fs
./usr/bin/chattr
To list only files:
# rpm -qlp packagename.rpm
To list files with permission with ownership:
# rpm2cpio packagename.rpm | cpio -tv
To list files with detailed description about the RPM:
# less packagename.rpm
Next to extract a file from a RPM, we can again use the 'rpm2cpio' command along with 'cpio' with different switches as shown as follows:
[root@hostxyx tmp]# rpm2cpio packagename.rpm | cpio -idvm
./etc/blkid
./etc/mke2fs.conf
./sbin/badblocks
./sbin/blkid
./sbin/debugfs
./sbin/dumpe2fs
./sbin/e2image
./sbin/fsck
./sbin/logsave
./sbin/resize2fs
./usr/bin/chattr
.
.
<Output truncated>
The above command will create directories such as ./etc, ./sbin, ./usr under the folder where RPM is kept. Please note this wouldn't install the RPM on the system, it will only extract the files. Once you grab the file that you wish to, just delete all the directories that are created. Never execute this command being in /, as it will mess up the entire file-system.
No comments:
Post a Comment