Skip to content

Instantly share code, notes, and snippets.

Last active Oct 9, 2020
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
# The same but showing only the package name (without version)
$ rpm -qf /bin/ls --queryformat '%{NAME}\n'
# Search for installed package
$ rpm -q BitTorrent
# List files from installed package
$ rpm -ql BitTorrent
# 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 || :
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 || :
# 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