option for dpkg, according to "man dpkg" is:
Get list of package selections, and write it to stdout. Without
a pattern, packages marked with state purge will not be shown.
For searching for packages, I like to use aptitude instead of dpkg or apt-cache. To search for a package with aptitude, just run:
aptitude search package_name
If you don't know the exact name of the package, it will list anything that matches the search term. For example, try running:
aptitude search java
and it will list all the packages with java in their names.
An "i" before the package means that it is installed. And an "A" after the "i" means that the package was automatically installed (for example, as a dependency). A "p" before a package means it is purged (i.e., not installed).
To get more info about a specific package, use:
aptitude show package_name
and you will get detailed info about that package.
The apt-get and aptitude commands differ in how they handle dependencies. Suppose package A has as it's dependencies packages B, C, and D. Both apt-get and aptitude will install the dependencies. But if you remove package A with apt-get, it will leave dependencies B, C, and D on your system, unless you use the --purge option with apt-get.
Aptitude will remove dependencies B, C, and D, as long as they are not needed by other packages.
Keep in mind that synaptic, Add / Remove, and update manager in Ubuntu are GUI front ends for apt-get, not aptitude.
Here is an excellent tutorial on aptitude:
You should not mix apt-get and aptitude. Be consistent. For best results, wither use apt-get exclusively or aptitude exclusively.
Aptitude is the recommended package manager now in Debian. For Ubuntu though, I would recommend that you use apt-get to be consistent with update manager. If you do not use update manager, synaptic, or Add / Remove, and if you do all updates and package management from the terminal, then it is your choice whether to use apt-get or aptitude.