17

I would like to know what some specific package installs, for example, when installing ncurses, I have found that TAB key expands:

sudo apt-get install ncurses-

to show:

ncurses-base      ncurses-doc       ncurses-hexedit
ncurses-bin       ncurses-examples  ncurses-term

How could I know what, say, ncurses-term installs? I am interested mainly in programs, but libraries and any other filetypes could be useful too.

Command-line method, if possible, would be preferred (any others accepted too).

  • When you say "programs" are you talking about binaries? – Braiam Mar 16 '14 at 22:54
  • Binaries and scripts, if possible, thanks, @Braiam. – Sopalajo de Arrierez Mar 16 '14 at 23:42
20

Here are a few options, these will list all the files installed by a package:

A. Listing all files included in a package

  1. For installed packages

    dpkg -L ncurses-term
    
  2. For all packages, installed or not

    apt-file -F list ncurses-term
    

    The -F turns of pattern matching so that only packages whose exact name matches are returned. You may need to install apt-file with sudo apt-get install apt-file and then update its database with sudo apt-file update.

B. Listing only executable files included in a package

  1. For installed packages

    Just install dlocate (sudo apt-get dlocate) and run:

    dlocate -lsbin ncurses-term 
    

    As explained in man dlocate:

    -lsbin List full path/filenames of executable files (if any) in package

    If you don't want to install additional packages, you can do this manually. Just collect the list of files and find any among them that have the executable bit set:

    apt-file -F list ncurses-term | cut -d ' ' -f 2 | 
        while read file; do [[ -x $file && -f $file ]] && echo "$file"; done
    

    The little scriptlet above will print the path only (cut -d ' ' -f 2) and then pass it through a while loop that checks if the file is executable (-x $file) and if it is a regular file, no directories or symlinks (-f $file) and prints its name only if passes both tests.

  2. For all packages, installed or not

    There is no way I know of to list only executables included in an uninstalled package. However, since most executables are installed to bin directories, you can get most of them by parsing the output:

     apt-file -F list ncurses-term | grep -Ew "bin|sbin"
    

    The -w option matches entire words, so you don't get things installed in, for example, trashbin or whatever.


NOTE: None of the above commands will produce any output for ncurses-term but that is because this package installs no executable files. The commands work nevertheless, try with a different package.

  • Hi terdon, are you sure the command should work on not-installed applications? when I try, it simply offers to install. Which is not that strange, as the .install file is (probably) downloaded with the application? – Jacob Vlijm Mar 16 '14 at 22:21
  • @Jacob yes, I just tried with a package I know is not installed and apt-file listed the package's contents. Works on Debian testing and Ubuntu 13.10. – terdon Mar 16 '14 at 22:23
  • Aha, thanks, it makes sence I just thought, as the dependecies are shown as well on not installed applications. – Jacob Vlijm Mar 16 '14 at 22:40
4

You could use apt-file:

sudo apt-file update        
apt-file list package_name
  • 3
    If apt-file is not installed you can install it with sudo apt-get install apt-file. – edwin Mar 16 '14 at 22:15
3

There's a possibility using your browser (therefore not requiring access to a APT-system). For example, to list the file contents of package "ncurses-term", just type

https://packages.debian.org/wheezy/all/ncurses-term/filelist

into your browser's address bar (replace "wheezy" as needed) for Debian or

http://packages.ubuntu.com/saucy/all/ncurses-term/filelist

for Ubuntu (replace "saucy" as needed).

  • An interesting method. This list is for Debian packages, so: is it supposed to be the same for any other distro like Ubuntu or Kali? – Sopalajo de Arrierez Mar 17 '14 at 9:25
  • 1
    @Sopalajo de Arrierez: Read precisely: I have also posted the link for the same package (ncurses-term in this example) for Ubuntu. The file list might be the same if a specific Ubuntu version has the same version of the package than one of the Debian sets, but it isn't necessarily. Ubuntu, Kali, Aptosid, CrunchBang and all the other Debian-based distributions could make modifications to packages as they like (especially files like "README" or configuration files for the init system). – Michael Kremser Mar 17 '14 at 11:11
  • I understand, @MichaelKremser. So, as I can see, searching the web for the contents of a package is useful but, preferably, you should search on the official package list of your specific distro. – Sopalajo de Arrierez Mar 17 '14 at 13:01
  • 1
    @Sopalajo de Arrierez: Yes, right. If you're on Debian Wheezy, use the package list for Debian Wheezy, if you're on Debian testing, use that one, if you're on Ubuntu Precise, take its list. There always can be differences, although for example Ubuntu takes a lot of packages from Debian unmodified. However, this might change anytime. – Michael Kremser Mar 17 '14 at 14:17

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.