How To List The Dependencies Of A Package In Linux
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 couldn’t 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 vim ├─vim-runtime ├─gpm │ └─bash │ ├─readline │ │ ├─glibc │ │ │ ├─linux-api-headers │ │ │ ├─tzdata │ │ │ └─filesystem │ │ │ └─iana-etc │ │ ├─ncurses │ │ │ ├─glibc │ │ │ └─gcc-libs │ │ │ └─glibc │ │ └─ncurses provides libncursesw.so │ ├─glibc │ └─ncurses └─acl └─attr └─glibc
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 vim Depends: vim-common Depends: vim-runtime Depends: libacl1 Depends: libc6 Depends: libgpm2 Depends: libpython2.7 Depends: libselinux1 Depends: libtinfo5 Suggests: <ctags> exuberant-ctags:i386 exuberant-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. That’s all for today. I will be soon here with another interesting guide. Until then, stay tuned with OSTechNix. If you find our guides useful, please spend a moment to share them on your social, professional networks, so that other users can also benefit.
Thanks for stopping by!
Help us to help you:
- Subscribe to our Email Newsletter : Sign Up Now
- Support OSTechNix : Donate Via PayPal
- Download free E-Books and Videos : OSTechNix on TradePub
- Connect with us: Facebook | Twitter | Google Plus | LinkedIn | RSS feeds
Have a Good day!!