which vs. whereis vs. dpkg -L

terminalWhile most people using any flavour of Linux must have used which to locate where an executable binary of a command is located, a similar utility whereis may not be so well-known. which looks for a binary within the directories in your $PATH. whereis on the other hand returns you a lot more; it shows you almost everything that came with the command – binary, source code and the man pages location. Quite useful! Example:

$ whereis ls

Now let’s see what dpkg -L can do for Debian packages. You installed a .deb file and you want to know quickly which are the files that got installed with it. Here’s how to do it:

To get the correct name of the package gcstar:

$ dpkg --get-selections|grep gcstar
gcstar                        install

To see which files were installed by this package:

$ dpkg -L gcstar

One thought on “which vs. whereis vs. dpkg -L”


Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s