Jul 292015
 

Yum Search vs Yum ListYum is one of the most powerful tools in the arsenal of a RedHat or CentOS systems administrator for package management.

When installing, upgrading, removing or searching for packages, yum is the best choice because it automatically resolves dependencies.

In this post, let’s examine the difference between yum search and yum list commands.

While both command are used to find a package, yum search is more comprehensive.

When you run yum search, the command searches for package name, summaries and description.

But yum list only looks for the search term in the package name.

Here’s an example of how the two commands differ in their results.

Let’s first try yum search without any glob expression.

# yum search vim
vim-gtk-syntax.noarch : Vim syntax highlighting for GLib, Gtk+, Gstreamer, and more
vim-vimoutliner.noarch : Script for building an outline editor on top of Vim
beakerlib-vim-syntax.noarch : Files for syntax highlighting BeakerLib tests in VIM editor
golang-vim.noarch : Vim plugins for Go
protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers descriptions
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
vim-clustershell.noarch : VIM files for ClusterShell
vim-common.x86_64 : The common files needed by any version of the VIM editor
vim-enhanced.x86_64 : A version of the VIM editor which includes recent enhancements
vim-filesystem.x86_64 : VIM filesystem layout
vim-minimal.x86_64 : A minimal version of the VIM editor
vile-common.x86_64 : The common files needed by any version of the VIM editor
youtube-dl.noarch : A small command-line program to download online videos

As we can see in the above output, vim is present in both the package name and description.

Now let’s run the yum list command with the wildcard character * and examine the results.

# yum list '*vim*'
Installed Packages
vim-common.x86_64                                                                        2:7.4.160-1.el7                                                               @base    
vim-enhanced.x86_64                                                                      2:7.4.160-1.el7                                                               @base    
vim-filesystem.x86_64                                                                    2:7.4.160-1.el7                                                               @base    
vim-minimal.x86_64                                                                       2:7.4.160-1.el7                                                               @anaconda
Available Packages
beakerlib-vim-syntax.noarch                                                              1.10-2.el7                                                                    epel     
golang-vim.noarch                                                                        1.3.3-3.el7                                                                   base     
protobuf-vim.x86_64                                                                      2.5.0-7.el7                                                                   epel     
vim-X11.x86_64                                                                           2:7.4.160-1.el7                                                               base     
vim-clustershell.noarch                                                                  1.6-4.el7                                                                     epel     
vim-gtk-syntax.noarch                                                                    20130716-1.el7                                                                epel     
vim-vimoutliner.noarch                                                                   0.3.7-5.el7                                                                   epel

As we see from the above results, yum list only considers the search term in the package name.

By the way, yum search all is even more exhaustive but runs a bit slower.

Sorry, the comment form is closed at this time.