Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I used to use yum to list all installed packages:

yum list installed

Now I need to list top level packages only i.e. if a package is a dependency of another, it should not be shown. GNOME's Add/Remove Software can do this but I need the output in a terminal.

I checked yum manual but I could not find a switch for that.

share|improve this question

2 Answers 2

up vote 10 down vote accepted

You can use the tool package-cleanup which is part of yum-utils. Besides finding packages which are not available from the current yum repositories, finding packages with broken dependencies, pruning old kernels and finding duplicate packages it can also find packages on which no other packages depend. Those are called leaves. Do

yum install yum-utils

to get package-cleanup and

package-cleanup --leaves --all

to get a list of all leaves.

share|improve this answer
    
The Debian/Ubuntu terminology for this is orphans. –  Tshepang Feb 24 '11 at 22:05
2  
@Tshepang, this is not correct - not all leaves are unused. And not all orphan packages are necessarily leaves. Orphan packages in Debian terminology means: previously as dependency (including transitive dependencies) installed packages that are now unneeded because the explicitly named installed packages are now removed. –  maxschlepzig Jul 13 '13 at 16:14

You can use the command repoquery (part of the package yum-utils) to get this information:

$ repoquery --installed --qf '%{n} - %{yumdb_info.reason}' --all \
    | grep 'user$' | cut -f1 -d' '

It only lists packages you have installed on your own - not those which are part of the base install. Depending on your use case this is what you want or not.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.