Home FAQ How To List The Dependencies Of A Package In Linux

How To List The Dependencies Of A Package In Linux

By sk
Published: Last Updated on 14.9K views

The other day I was trying to figure out if there is any easy way to find or list the dependencies of a package in Linux. I have been using Linux as my primary OS for few years now, yet I don't know how to find the dependencies for a certain package. Fortunately, I found a workaround after a few google searches and wanted to share it with our readers. So, here you go.

List The Dependencies Of A Package In Linux

On Arch Linux and derivatives such as Antergos and Manjaro Linux, Pacman provides an useful command called "Pactree". For those wondering, Pactree produces a dependency tree for a given package, say vim.

$ pactree vim
│ └─bash
│ ├─readline
│ │ ├─glibc
│ │ │ ├─linux-api-headers
│ │ │ ├─tzdata
│ │ │ └─filesystem
│ │ │ └─iana-etc
│ │ ├─ncurses
│ │ │ ├─glibc
│ │ │ └─gcc-libs
│ │ │ └─glibc
│ │ └─ncurses provides libncursesw.so
│ ├─glibc
│ └─ncurses

As you see in the above output, Pactree lists the dependencies of "vim" package in a nice tree-like format.

To know more details pactree command, refer the man pages.

$ man pactree

For Fedora, Red Hat and its clones like CentOS, Scientific Linux, refer the following link.

On Debian, Ubuntu, and its derivatives like Linux Mint, Elementary OS, you can use apt-cache command to list the dependencies of a particular package.

To list what a package, say for example vim, depends on, run:

$ apt-cache depends vim
 Depends: vim-common
 Depends: vim-runtime
 Depends: libacl1
 Depends: libc6
 Depends: libgpm2
 Depends: libpython2.7
 Depends: libselinux1
 Depends: libtinfo5
 Suggests: <ctags>
 Suggests: vim-doc
 Suggests: vim-scripts
 Conflicts: vim:i386

To list what depends on a package, say for example vim, run:

$ apt-cache rdepends vim

The above command displays the packages that depend on the vim package.

For more details, run:

$ apt-cache --help


$ man apt-cache

On SUSE and openSUSE, you can list the dependencies of a given package using "zypper" command as shown below.

$ zypper info --requires vim

Hope this helps.

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

1 comment

Arun Khan August 18, 2017 - 2:50 am

On RHEL or derivatives — use ‘yum whatprovides|provides’


Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More