Ubuntu / Linux news and application reviews.

There are various reasons why you may need to find out to which PPA a package belongs to, for instance, in case a package in a PPA breaks something on your system, if you want to install a package which is already installed on your computer on some other machine but you don't know the PPA you've used to install it and so on.

So here's a quick tip on how to find out to which PPA a package belongs to. 

To find out the PPA to which a package belongs to, simply run the following command in a terminal:
apt-cache policy PACKAGE_NAME
replacing "PACKAGE_NAME" with the package you want to find out the PPA for.

Example:
apt-cache policy oracle-java7-installer

Here's how the command output looks like:

apt-cache pollicy

As you can see, the command output displays the PPA url, which, right after "ppa.launchpad.net" contains the PPA you've used to install the package ("webupd8team/java" in my example above).

This, of course, also works with packages from the official Ubuntu repositories as well as packages from non-Launchpad repositories. For instance, here's how the output of "apt-cache policy opera" looks like (Opera is installed through its own repository):

apt-cache pollicy

If the repository url is missing, it means you've installed the deb manually, not through a repository (and the package is not available in any repository on your system) or that the repository has been disabled or removed after the package installation.