-8

I have two questions-

  1. List all packages order by name
  2. Search for a specific package that is intalled or not?
Dhairya Lakhera
  • 199
  • 1
  • 2
  • 7
  • 3
    Welcome to Unix Stackexchange! You can [take the tour](http://unix.stackexchange.com/tour) first and then learn [How to Ask a good question](http://unix.stackexchange.com/help/how-to-ask). That makes it easier for us to help you. – andcoz Aug 21 '18 at 11:57
  • 3
    Possible duplicate of [CentOS: List the installed RPMs by date of installation/update?](https://unix.stackexchange.com/q/2291/56041) and possibly [Different list of installed packages reported by rpm compared to yum](https://unix.stackexchange.com/q/146159/56041). (But it is not clear you made an effort and had trouble due to differences; or made no effort). –  Oct 03 '18 at 23:00

1 Answers1

0

From man sort

NAME top

  sort - sort lines of text files

SYNOPSIS top

  sort [OPTION]... [FILE]...
  sort [OPTION]... --files0-from=F

DESCRIPTION top

  Write sorted concatenation of all FILE(s) to standard output.

  With no FILE, or when FILE is -, read standard input.

 Mandatory arguments to long options are mandatory for short options
  too.  Ordering options:

From man yum

yum list installed [glob_exp1] [...]

List the packages specified by args. If an argument does not match the name of an available package, it is assumed to be a shell-style glob and any matches are printed.

So,

  1. To list all packages order by name

    yum list installed | sort
    
  2. Search for a specific package that is intalled or not:

    I can not check this since I do not have a CentOS system at disposal, but from man pages this should work:

    yum list installed $packageName
    

    What will return the result you look for is this:

    yum list installed | grep $packageName
    
OneK
  • 199
  • 3