Skip to content

Instantly share code, notes, and snippets.

@juanje
Last active Oct 9, 2020
Embed
What would you like to do?
RPM tips & tricks
# Just a place to write down notes for old time Debian/Ubuntu user
# that has just moved into Fedora/RedHat world
# Show which package provides the file '/bin/ls'
# Similar to 'dpkg -S /bin/ls'
$ rpm -qf /bin/ls
coreutils-8.5-7.fc14.i686
# The same but showing only the package name (without version)
$ rpm -qf /bin/ls --queryformat '%{NAME}\n'
coreutils
# Search for installed package
$ rpm -q BitTorrent
BitTorrent-5.2.2-1.noarch
# List files from installed package
$ rpm -ql BitTorrent
/usr/bin/bittorrent
/usr/bin/bittorrent-console
...
# See the package's scripts (postinstall, preuninstall, postunnstall...)
$ rpm -q --scripts httpd
postinstall scriptlet (using /bin/sh):
if [ $1 -eq 1 ] && [ -x /usr/bin/systemctl ]; then
# Initial installation
/usr/bin/systemctl --no-reload preset httpd.service htcacheclean.service httpd.socket || :
fi
preuninstall scriptlet (using /bin/sh):
if [ $1 -eq 0 ] && [ -x /usr/bin/systemctl ]; then
# Package removal, not upgrade
/usr/bin/systemctl --no-reload disable --now httpd.service htcacheclean.service httpd.socket || :
fi
...
# List all installed packages (dpkg -l)
$ rpm -qa
# List the last installed packages
$ rpm -qa --last
# Rebuild (editing) a RPM file
$ rpmrebuild -enp package.rpm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment