Enhancing Skills

apt-cache depends package_name: Show the dependencies of a package

Command: apt-cache depends package_name

Used to list the packages that a specified package depends on. This helps in understanding which other packages are required for the specified package to function correctly.


Sample Command and Output:

$ apt-cache depends vim
vim
  Depends: vim-common
  Depends: vim-runtime
  Depends: libncurses5
  Depends: libc6

Description:

  • apt-cache depends <package_name>: Displays the packages that are required by the specified package (vim in this example). It lists the direct dependencies that need to be installed for the package to work properly.

Additional Commands and Sample Outputs:

  • apt-cache rdepends package_name: Show the packages that depend on the specified package. Sample Command and Output:
  $ apt-cache rdepends vim
  vim
    Reverse Depends: 
      vim-gtk
      vim-tiny
      vim-common
      vim-runtime

Description:

  • apt-cache rdepends <package_name>: Lists the packages that depend on the specified package. This helps in understanding the impact of removing a package on other installed packages.
  • apt-cache showpkg package_name: Show detailed package information including dependencies. Sample Command and Output:
  $ apt-cache showpkg vim
  Package: vim
  Versions:
   2:8.1.2269-1ubuntu5 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_focal_main_binary-amd64_packages)
      Description Language:
      File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_focal_main_binary-amd64_packages
      MD5: e3d7a5c6e42a9f8b9f4d891f62b7d4f7

  Reverse Depends:
    vim-gtk, vim 2:8.1.2269-1ubuntu5
    vim-tiny, vim 2:8.1.2269-1ubuntu5

Description:

  • apt-cache showpkg <package_name>: Provides detailed information about the package including its dependencies, available versions, and reverse dependencies.

Note: Use apt-cache depends to check the dependencies of a package before installation to ensure all required dependencies are satisfied.


Leave a Reply

Your email address will not be published. Required fields are marked *

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