Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

Is there a generalised way to find out what package caused the installation of a command?

share|improve this question

marked as duplicate by muru, Eric Carvalho, Ravan, David Foerster, hg8 Dec 28 '15 at 9:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 18 down vote accepted

Open a terminal and try the following commands:

dpkg -S 'command name'

eg: dpkg -S /bin/ls

Sample output:

coreutils: /bin/ls

You can also obtain detailed status information about coreutils package, enter:

 dpkg -s coreutils

Sample output:

Package: coreutils
Essential: yes
Status: install ok installed
Priority: required
Section: utils
Installed-Size: 9040
Maintainer: Ubuntu Core Developers 
Architecture: i386
Version: 5.97-5.3ubuntu3
Replaces: textutils, shellutils, fileutils, stat, debianutils (<= 2.3.1), dpkg (<< 1.13.2)
Provides: textutils, shellutils, fileutils
Pre-Depends: libacl1 (>= 2.2.11-1), libc6 (>= 2.6-1), libselinux1 (>= 2.0.15)
Conflicts: stat
Description: The GNU core utilities
 This package contains the essential basic system utilities.
 .
 Specifically, this package includes:
 basename cat chgrp chmod chown chroot cksum comm cp csplit cut date dd df dir
 dircolors dirname du echo env expand expr factor false fmt fold groups head
 hostid id install join link ln logname ls md5sum mkdir mkfifo mknod mv nice nl
 nohup od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
 sha1sum seq shred sleep sort split stat stty sum sync tac tail tee test touch
 tr true tsort tty uname unexpand uniq unlink users vdir wc who whoami yes
Original-Maintainer: Michael Stone 
share|improve this answer

From the command name you can use the 'type' and 'dpkg' commands to determine the package which is responsible for their installation. For example to find out which package installed the command 'who' you could do the following commands at a command prompt:

$ type who
who is /usr/bin/who
$ dpkg -S /usr/bin/who
coreutils: /usr/bin/who
share|improve this answer

there is another one method, maybe a little silly, but faster than previous ones :) just mistype a command and you will get correct command name and package it came from.

Sample output:

pawel@pawel-desktop:/var/www$ sfn
No command 'sfn' found, did you mean:
 Command 'sn' from package 'mono-devel' (main)
 Command 'sfc' from package 'syfi-bin' (universe)
 Command 'svn' from package 'subversion' (main)
sfn: command not found
share|improve this answer
    
That is indeed very silly! – LassePoulsen Nov 18 '10 at 10:56
1  
but it works :P – Paweł Karpiński Nov 18 '10 at 11:53

You can also do it with one line:

dpkg -S $(which command)

For example, I want to know what package contains ls:

dpkg -S $(which ls)

And here is the output:

coreutils: /bin/ls

So now I know that ls command, /bin/ls file, comes from coreutils package.

share|improve this answer

Now for a completely different approach.

Go to packages.ubuntu.com and follow your nose. In particular, scroll down to "Search the contents of packages" and enter the file name or system command.

share|improve this answer
  1. drop to a command prompt (Menu > Applications > Accessories > Terminal)
  2. enter dpkg-query --search 'command' where 'command' is the command whose owning package you're trying to find.
share|improve this answer

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