Showing posts with label rpm. Show all posts
Showing posts with label rpm. Show all posts

Saturday, 11 August 2012

How to see which package a file belongs to

Previously I wrote a post talking about how to see what files were installed as a part of a package. In this post, I'll talk about going to other way i.e. how to tell which package a file belongs to

On Debian/Ubuntu you can do so using the dpkg search function:

# sudo dpkg -S /etc/init.d/whoopsie
whoopsie: /etc/init.d/whoopsie


On RedHat/CentOS you can use the rpm command:

# rpm -qf /usr/bin/bash

Tuesday, 29 November 2011

How to see files installed by a package

If you've ever downloaded a package on Debian (or any of its derivatives) and want to see which files were installed, it's easily accomplished using the 'dpkg-query' command:

$ dpkg-query -L vsftpd
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/vsftpd
/usr/share/doc/vsftpd/FAQ.gz
/usr/share/doc/vsftpd/examples
...
...
/usr/share/doc/vsftpd/changelog.Debian.gz
/usr/share/doc/vsftpd/REWARD
/usr/share/doc/vsftpd/SPEED
/usr/share/man
/usr/share/man/man8
/usr/share/man/man8/vsftpd.8.gz
/usr/share/man/man5
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/sbin
/usr/sbin/vsftpd
/etc
/etc/init.d
/etc/pam.d
/etc/pam.d/vsftpd
/etc/init
/etc/init/vsftpd.conf
/etc/vsftpd.conf
/etc/logrotate.d
/etc/logrotate.d/vsftpd
/etc/ftpusers
/etc/init.d/vsftpd


The above example is for the 'vsftpd' package, but this equally applies to all of the other packages installed using dpkg/apt.

In case you're on a system which uses yum (Fedora, RedHat, CentOS etc...) you can use 'rpm -ql [package name]':


# rpm -ql yum-cron
/etc/cron.daily/0yum.cron
/etc/rc.d/init.d/yum-cron
/etc/sysconfig/yum-cron
/etc/yum/yum-daily.yum
/etc/yum/yum-weekly.yum
/usr/share/doc/yum-cron-3.2.29
/usr/share/doc/yum-cron-3.2.29/COPYING