Get the package which provides a command in Ubuntu or Debian
January 14, 2016

This tip is for Ubuntu or Debian users.

In Ubuntu or Debian, it is sometimes useful to know which package contains a certain command. This is the command:

dpkg -S `which command-name`

Replace command-name with the name of the command which you would like to find the containing package for.

Explanation:

  • The -S option tells dpkg to search for a package
  • The which command finds the full path for a command.
  • The two backticks around the which command tells bash to execute the command and pass it’s output on to dpkg as an argument.
Patrick G
Patrick G
I like to write code. I love open source software. I like to self-host stuff.