Yellowdog Updater Modified or Yum for short is a package management tool for RPM packages. It is popular in the REHL family of Linux distributions, including CentOS and Fedora. Thus, you can think of yum as a bootstrap for RPM package manager.

Like popular package managers, Yum works via repositories that contain collections of tools in rpm format.

For this quick one, we will discuss the basics of yum and show available packages on a system using yum as a package manager.

Yum List Available Packages

To show available packages, we can use the yum list command as shown:

This command will display the name of all the available packages, the latest version, and the repositories to which they belong

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/1-17.png" data-lazy- height="329" src="data:image/svg xml,” width=”1525″>

Yum Check Installed Packages

Yum is incredibly easy to use; like most package managers, it allows you to pass intuitive options. For example, to show the list of installed packages, we can use the command:

Similar to show available packages, the command above will show the name of the packages installed, the version, and the source repository of the packages

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/2-16.png" data-lazy- height="379" src="data:image/svg xml,” width=”1561″>

You can pass the output from the command above to tools such as grep, less, etc.

Yum Search Specific Package

An example use case of the yum list command is checking if you have a specific package installed. For example, let us see if awk is installed.

sudo yum list installed | grepawk

The above command passes the output of the yum list to grep, which then searches for the specific string, in this case, ‘awk.’ Take a look at the example output below:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/3-14.png" data-lazy- height="39" src="data:image/svg xml,” width=”978″>

As you can see, we have awk installed (as part of gawk) and the python-Hawkey package.

Show Available Packages From A Specific Repo

You can also filter for the available package in a specific repository. We can start by listing all enabled repositories with the command:

This will list all the available repositories in the system.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/4-14.png" data-lazy- height="124" src="data:image/svg xml,” width=”1108″>

To search for packages available only in a specific repo. An example, in the epel repository, we use the command:

sudo yum list available | grep epel

Example output is as shown:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/5-14.png" data-lazy- height="412" src="data:image/svg xml,” width=”1138″>

Conclusion

In this quick tutorial, we covered yum and showed the available and installed packages in the system.

Thanks for reading!

About the author

<img alt="" data-del="avatar" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/john-150×150.png60d8c8ba21813.jpg" height="112" src="data:image/svg xml,” width=”112″>

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list