I am here to show you two examples of using dpkg to query package info.
To know what deb package is installed, you can do this
dpkg -l
Usually we do this with grep, to filter only info that we are interested in, let say i want to know the packages consist of keyword gcc.
dpkg -l | grep gcc
If I want to know the binary files are from which deb package, i can do that, let say i want to know for gnome-help.
dpkg -S `which gnome-help`
which is to shows the full path for gnome-help and it uses back quote to pass the result to dpkg.
Output:
yelp: /usr/bin/gnome-help