I have added new repository into my repositories and I want to list all packages. Find total count of packages and filter some of packages I am interested. And now we can start the process.
List All Repository Packages
yum command have
list option which will list all packages from currently available repositories. This will check all currently enabled repositories.
$ yum list
We have listed all packages. As we see first installed packages are listed . Installed packaged are listed as installed if the packages are not installed their repository is written like @base . We can see that there is also package versions which will print current package version with the repository version like
Filter Listed Packages
While listing packages we may need to specific packages. We will get the help of grep command while using
yum list . We will grep packages which name have
$ yum list | grep stack
- We provide | grep stack to filter packages which provide stack word
List Installed Packages
If we need only installed packages to list we need to provide the
installed at the end of the
yum list command like below.
$ yum list installed
Filter Installed Packages
If we want too list specific packages which is all ready installed in the current system we will use the
grep command again. In this example we will list packages which names contains
$ yum list installed | grep "user"
List Package History
During the package operations all transactions are stored in the yum history. We can list this history with the
history list command like below. Because this command may contains sensitive data we need to use
root privileges if not we will get an error like
Error: This command has to be run under the root user. .
List Group Packages
Distributions like CentOS, Fedora, RedHat provides group packages which contains multiple package to setup different environments. These environments can be development, XFCE etc. We can use
grouplist in order to list this group packages.
$ yum grouplist
As we can see from screenshot that there is different packages like Environment Groups, Installed Environment Groups etc.
Filter Group Packages
In some cases we may need to filter listed group packages. We will again use
grep command in order to filter listed group packages. In this example we will filter groups packages which name contains
Desktop in order to list desktop group packages.
$ yum grouplist | grep Desktop
We can count packages too. We can count total packages those starts with a like below. We will use
wc command with the
$ yum list | grep -e "^a" | wc -l 383