4th Floor, 4 Tabernacle Street London EC2A 4LU

RedHat vs Ubuntu – Useful Package Commands

TaskRed Hat/FedoraUbuntu
Refresh list of available packagesYum refreshes each time it’s usedapt-get update
Install a package from a repositoryyum install package_nameapt-get install package_name
Install a package fileyum install package.rpm
rpm -i package.rpm
dpkg –install package.deb
Remove a packagerpm -e package_nameapt-get remove package_name
Check for package upgradesyum check-updateapt-get -s upgrade
apt-get -s dist-upgrade
Upgrade packagesyum update
rpm -Uvh [args]
apt-get dist-upgrade
Upgrade the entire systemyum upgradeapt-get dist-upgrade
Get information about an available packageyum search package_nameapt-cache show package_name
Show available packagesyum list availableapt-cache dumpavail
List all installed packagesyum list installed
rpm -qa
dpkg –list
Get information about an installed packageyum info package_name
rpm -qi package_name
dpkg –status package_name
List files in an installed packagerpm -ql package_namedpkg –listfiles package_name
List documentation files in an installed packagerpm -qd package_name
List configuration files in an installed packagerpm -qc package_name
Show the packages a given package depends onrpm -qR package_nameapt-cache depends package_name
Show other packages that depend on a
given package (reverse dependency)
rpm -q -whatrequires [args]apt-cache rdepends package_name
Find packages with substring in nameyum list “*substring*”
Get information about a package filerpm -qpi package.rpmdpkg –info package.deb
List files in a package filerpm -qpl package.rpmdpkg –contents package.deb
List documentation files in a package filerpm -qpd package.rpm
List configuration files in a package filerpm -qpc package.rpm
Extract files in a packagecpio -viddpkg-deb –extract package.deb dir-to-extract-to
Find package that installed a filerpm -qf filenamedpkg –search filename
Find package that provides a particular fileyum provides filenameapt-file search filename
Show stats about the package cacheapt-cache stats
Verify all installed packagesrpm -Vadebsums
Remove packages from the local cache directoryyum clean packagesapt-get clean
Remove only obsolete packages from the local cache directoryapt-get autoclean
Remove header files from the local cache directory
(forcing a new download of same on next use)
yum clean headersapt-file purge
Repository location configuration/etc/yum.conf/etc/apt/sources.list
Starting/stopping services immediatelyservice httpd start/etc/init.d/apache start
service apache start
Enabling a service at bootchkconfig httpd onupdate-rc.d apache defaults
sysv-rc-conf apache on
Disabling a service at bootchkconfig httpd offupdate-rc.d apache purge
sysv-rc-conf apache off