package utility command in linux

Have you ever want to know Where is the files go when you install any package? or What package this file belong to? This post is about some package utility command that I've use many time but never remember.

To list all files in the package.

dpkg -L package-name

rpm -ql package-name

To find out which package[ we installed ] contains this file.
dpkg -S file

rpm -qf file

To list installed package.
dpkg -l

rpm -qa

To find out which package[ we not installed ] contains this file.
apt-file search file

yum whatprovides file

Many situations in linux that you're complained about missing some library file to do something. Use this command to find the required package.