19

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).

Zanna
  • 70,465
Sopalajo de Arrierez
  • 961
  • 3
  • 12
  • 22

3 Answers3

24

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 install 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.

  1. 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.

terdon
  • 100,812
  • 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
5

You could use apt-file:

sudo apt-file update        
apt-file list package_name
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 09: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