Package Management Cheat Sheet for Ubuntu ,RHEL and SuSE

RPM vs dpkg

Function rpm commanddpkg command
List installed packagesrpm -qadpkg -l
List content of installed packagerpm -ql “pkgname”dpkg -L “pkgname”
List content of package filerpm -qlp “pkgname”.rpmdpkg –contents “pkgname”.deb
Install packagerpm -i “pkgname”.rpmdpkg -i “pkgname”.deb
Show to which package a file belongsrpm -qf /path/to/filedpkg -S /path/to/file
Simulate installation of packagerpm -i –test “pkgname”.rpmdpkg -i –simulate “pkgname”
Update a packagerpm -U “pkgname”.rpmN/A (use dpkg -i)
Uninstall/remove a packagerpm -e “pkgname”dpkg -r “pkgname”

APT, Yum and Zypper Package Management Tools Cheasheet

Taskapt (deb)yum (rpm)zypper (rpm)
Install from repositoryapt-get install pkg-nameyum install pkg-namezypper install pkg-name
Update packageapt-get install pkg-nameyum update pkg-namezypper update -t package pkg-name
Remove packageapt-get remove pkg-nameyum erase pkg-namezypper remove pkg-name
Install from package filedpkg -i pkg-nameyum localinstall pkg-namezypper insta
Search by package nameapt-cache search pkg-name or apt-cache policy pkg-name or apt-cache madison pkg-nameyum list pkg-namezypper search pkg-name
Search by patternapt-cache search patternyum search patternzypper search -t pattern pattern
Search by file nameapt-file search pathyum provides filezypper wp file
List installed packagesdpkg -lrpm -qazypper search -is
Show package informationapt-cache show pgk-nameyum info pkg-namezypper info pkg-name
Update package listapt updateyum check-updatezypper refresh
Update systemapt upgradeyum updatezypper update
List repositoriesgrep -rhE ^deb /etc/apt/sources.list* or apt policyyum repolistzypper repos
Add repositoryadd to /etc/apt/sources.list.d/add to /etc/yum.repos.d/add to /etc/zypp/repos.d/
Remove repositoryremove from /etc/apt/sources.list.d/remove from /etc/yum.repos.d/remove from /etc/zypp/repos.d/
Enable repository add-apt-repository repositoryyum-config-manager –enable repositoryzypper addrepo URI name
Disable repository add-apt-repository -r repositoryyum-config-manager –disable repositoryzypper removerepo name

One thought on “Package Management Cheat Sheet for Ubuntu ,RHEL and SuSE

  • Leave a Reply

    Your email address will not be published. Required fields are marked *