Finding out what package a command came from

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

Asked By: oadams

  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.
Answered By: finley

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 
Answered By: aneeshep

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
Answered By: Andy

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
Answered By: Praweł

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.

Answered By: Shnatsel

Now for a completely different approach.

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

Answered By: 8128