RPM
List all installed packages:
1
$ rpm -qa
Get the list of all installed packages and their architecture:
1
$ rpm -qa --queryformat "%-40{NAME} %-8{ARCH}\n"
Same as above, but show i586 packages only:
1
$ rpm -qa --queryformat "%-40{NAME} %-8{ARCH}\n" | grep i586
Downgrade a package to an old version:
1
$ wget ftp://ftp.repository.org/mandrakelinux/official/10.0/package-1.0-1mdk.i586.rpm
2$ rpm -Uvh --oldpackage package-1.0-1mdk.i586.rpm
Unpack/Deflate/Extract a RPM without installing it:
1
$ rpm2cpio dummy.src.rpm | cpio -id
Evaluate %mkrel 3 rpm macro:
1
$ rpm --eval '%mkrel 3'
Force removal of a package that has problems with embedded βpre-β and/or βpost-β scripts:
1
$ rpm -e --noscripts packagename
Urpmi
List all available packages with name containing python:
1
$ urpmq --fuzzy python
Find which RPM contain the file named dummy:
1
$ urpmf dummy
Get information about the dummy RPM:
1
$ urpmq -i dummy
Get the list of all RPMs that require python-psyco package:
1
$ urpmf --requires python-psyco
Get the list of all RPMs that provide python-psyco package:
1
$ urpmf --provides python-psyco
I use this command in a cron entry to update automatically and regularly my Mandriva:
1
$ /usr/sbin/urpmi.update -a && /usr/sbin/urpmi --update --auto --auto-select
Generate urpmi repository index and metadata of the current folder:
1
$ genhdlist ./
Yum
Install a new package:
1
$ yum install subversion
Search for packages containing the x11 string:
1
$ yum search x11
Get the list of packages that provide Pythonβs Subversion bindings:
1
$ yum provides "*/svn/__init__.py"
Update repository index:
1
$ yum update
Clear all caches (sometimes required to force a repository index update):
1
$ yum clean all
Generate Yum repository index and metadata of the current folder:
1
$ createrepo -v ./