Yum Command Cheat Sheet
Yum is the package manager in Red Hat and Red Hat-based Linux distributions. It allows you to manage every aspect of software on your Red Hat system.
You are not going to learn Yum commands in detail here. Instead, this Yum cheat sheet provides you with a quick and easy overview of all major Yum package manager commands and their respective functionality.
You can download the Yum command cheat sheet in PDF form the link below:
Install, uninstall & upgrade packages
Here are the Yum commands for installing, removing and updating packages.
Command | Functionality | Example command |
---|---|---|
install | Install a package from yum repository | sudo yum install nginx |
remove | Remove an installed package and its dependencies | sudo yum remove nginx |
erase | Similar to remove command | sudo yum erase nginx |
update | Update or or more packages on the system | sudo yum update or sudo yum update gcc |
update-to | Update or or more packages to a specific version | sudo yum update-to ngingx-2.7-1.1 |
upgrade | update all packages to the latest version | sudo yum upgrade |
reinstall | Reinstall current version of a specific package | sudo yum reinstall httpd |
autoremove | Remove a package and all other unnecessary packages | sudo yum autoremove httpd |
downgrade | Downgrade a specific package to an earlier version | sudo yum downgrade nginx |
swap | Remove package and install another | sudo yum swap nginx httpd |
localinstall | Install a package from a local repository | sudo yum localinstall http://127.0.0.1/baseos/nginx-a.b.b.c.rpm |
groupinstall | Install packages from a specific group | sudo yum groupinstall "group name" |
Base Package Commands
These commands will help you explore installed packages or search for packages from repositories.
Command | Functionality | Example |
---|---|---|
list | List package names from repositories | sudo yum list all |
info | Show information about a specific package | sudo yum info nginx |
search | Search for a package name and description | sudo yum search apache |
updateinfo | Show information about available package updates | sudo yum updateinfo baseos |
check-update | Show available package updates from enabled repositories | sudo yum check-update |
grouplist | Show names and available package groups | sudo yum grouplist |
deplist | Show dependencies for a specific package | sudo yum deplist vsftpd |
provides | Locate the package that provides a specific file | sudo yum provides "*/bin/zsh" |
groupinfo | Show description and contents of a package group | sudo yum groupinfo "group name" |
help | Display yum help information or help on sub command | sudo yum help or sudo yum help list |
Managing Yum Repos
For adding and managing additional repositories.
Command | Functionality | Example |
---|---|---|
repolist | List the available software repositories | sudo yum repolist |
repo-pkgs | Use packages in a specific repository | sudo yum repo-pkgs baseos list |
repoinfo | Show information about enabled repositories | sudo yum repoinfo baseos |
makecache | Download repository data to cache | sudo yum makecache |
Troubleshooting Yum
When things go wrong with Yum, use these commands.
Command | Functionality | Example |
---|---|---|
clean | Clean out all cached package data/clean all packages metadata | sudo yum clean packages or sudo yum clean all |
check | Check local RPM db for problems | sudo yum check |
history | View and use yum transactions | sudo yum history list or sudo yum history undo or sudo yum history redo |
fssnapshot | Show LVM snapshots | sudo yum fs filters |
Helpful Options
Common options to be used with Yum commands:
Command Option | Functionality | Example |
---|---|---|
-y | Assume yes if prompted | sudo yum -y install nginx |
--assumeno | Assume no if prompted | sudo yum --assumeno install nginx |
-v | Verbose | sudo yum -v install |
-q | Quiet | sudo yum -q install |
--noplugins | Do not load any YUM plugins | sudo yum --noplugins install |
--disableplugin= | Deactivate a specific plugin | sudo yum --disableplugin=ps |
--enableplugin= | Activate a specific plugin | sudo yum --enableplugin=ps |
--changelogs | Show changelog info of a package | sudo yum --changelogs install httpd |
---filter=?? | Filter output for specific vendors, groups, architectures, and others. | sudo yum list available --filter=server |
--enablerepo= | Enable a deactivated repo | sudo yum install nginx --enablerepo=?? |
--disablerepo= | Disable an activated repo | sudo yum install nginx --deactivaterepo=?? |
--downloadonly | Download package and no install | sudo yum install --downloadonly httpd |
Extra Commands
Some additional commands that you may need to use once a while:
Commands | Functionality |
---|---|
reposync | Synchronize yum repo to local directory |
show-installed | Show installed packages |
verifytree | Check local repo for consistency |
yumdb | Change yum database |
yumdownloader | Download a package from repo to cwd |
repouery | Query remote repo and local db |
repoclosure | Get unmet dependency list |
needs-restarting | Show processes that have been updated and require restart |
If you feel lost at any time, you can always man yum
.
Liked what you just saw? You can download the entire stuff in PDF format from the link below.