{eks}catid=87|keyword=terminal|teaser|alpha{/eks}

 

Ubuntu documentation

Search commands

  • apt-cache search <search_term>

    This command will find packages that include <search_term>.

  • dpkg -l *<search_term>*

    This will find packages whose names contain <search_term>. Similar to apt-cache search, but also shows whether a package is installed on your system by marking it with ii (installed) and un (not installed).

  • apt-cache show <package_name>

    This command shows the description of package <package_name> and other relevant information including version, size, dependencies and conflicts.

  • dpkg --print-avail <package_name>
    This command is similar to "apt-cache show".
  • dpkg -L <package_name>

    This command will list files in package <package_name>.

  • dpkg -c foo.deb

    This command lists files in the package "foo.deb". Note that foo.deb is a pathname. Use this command on .deb packages that you have manually downloaded.

  • dlocate <package_name>

    This command determines which installed package owns <package_name>. It shows files from installed packages that match <package_name>, with the name of the package they came from. Consider this to be a "reverse lookup" utility.

    IconsPage/info.png In order to use this command, the package dlocate must be installed on your system.

  • dpkg -S <package_name>

    This command does the same as dlocate, but does not require the installation of any additional packages. It is slower than dlocate but has the advantage of being installed by default on all Debian and Ubuntu systems.

  • apt-file search <package_name>
    This command acts like dlocate and dpkg -S, but searches all available packages. It answers the question, "what package provides this file?".
    • apt-file needs to be updated regularly like apt-get. Use the command:

      apt-file update

    IconsPage/info.png In order to use this command, the package apt-file must be installed on your system.

  • apt-cache pkgnames
    This command provides a listing of every package in the system
  • A general note on searching: If searching for a generates a list that is too long, you can filter your results by piping them through the command grep. Examples:

    • apt-cache search filename | grep -w filename
      will show only the files that contain filename as a whole word
    • dpkg -L package | grep /usr/bin
      will list files located in the directory /usr/bin, useful if you're looking for a particular executable.

For more information on apt-get, apt-cache and dpkg consult their manual pages by using the man command. These manuals will provide a wider scope of information in addition to all of the options that you can use with each program.

IconsPage/example.png Example:

man apt-get