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 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
Or,
$ 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:
- 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: Reddit | Facebook | Twitter | LinkedIn | RSS feeds
Have a Good day!!
1 comment
On RHEL or derivatives — use ‘yum whatprovides|provides’