Howto list installed packages sorted by size
Thursday, October 1st, 2009rpm -qa –queryformat ‘%{SIZE} %{NAME} %{VENDOR}\n’ | sort -n -r | head -10
Check :rpm –querytags for all the tags
rpm -qa –queryformat ‘%{SIZE} %{NAME} %{VENDOR}\n’ | sort -n -r | head -10
Check :rpm –querytags for all the tags
RPM has an option (–prefix) that allows users to install rpms in other directories than the default ones.
Packages that allow to be installed in other directories are called : relocatable
[root@localhost gcc]# rpm -qpi libxslt-1.1.24-4.fc11.i586.rpm | grep Relocations
Name : libxslt Relocations: /usr
[root@localhost gcc]# rpm -qi libxslt | grep Relo
Name : libxslt Relocations: /usr
So basically you can install this package in other directory.
[root@localhost gcc]# rpm -ihv libxslt-1.1.24-4.fc11.i586.rpm –prefix $PWD –force
Preparing… ########################################### [100%]
1:libxslt ########################################### [100%]
[root@localhost gcc]# ls
bin lib libxslt-1.1.24-4.fc11.i586.rpm share
For example gcc is not relocatable and installing it in an different directory is not allowd:
[root@localhost gcc]# rpm -qi gcc | grep Relo
Name : gcc Relocations: (not relocatable)
[root@localhost gcc]# rpm -Uhv gcc-4.1.2-33.i386.rpm –prefix=$PWD
error: package gcc is not relocatable
To extract a cpio file:
cpio -iv < cpio_file
To list the contents of a cpio file:
cpio -itv < cpio_file
To create a cpio file with all files in the current directory:
ls | cpio -o > cpio_file
To extract all files from an RPM:
rpm2cpio RPM_file | cpio -idv
To extract individual file(s) from an RPM:
rpm2cpio RPM_file | cpio -id individual_file(s)
e.g. Extracting libcrypto.so.0.9.7a and libssl.so.0.9.7a from openssl-0.9.7a-2.i386.rpm:
rpm2cpio openssl-0.9.7a-2.i386.rpm | cpio -it egrep “libcrypto.so.0.9.7a|libssl.so.0.9.7a”
-rwxr-xr-x 1 root root 992092 Feb 27 12:10 ./lib/libcrypto.so.0.9.7a
-rwxr-xr-x 1 root root 216004 Feb 27 12:10 ./lib/libssl.so.0.9.7a
rpm2cpio openssl-0.9.7a-2.i386.rpm | cpio -idv ./lib/libssl.so.0.9.7a ./lib/libcrypto.so.0.9.7a
This will extract the two files from the RPM into a ./lib subdirectory.