Friday, January 18, 2008

HowTo: Identify Source Package Name Of A File or Folder

Here's a way to identify from which program package a file belongs to or which package a directory folder belongs to or created from? That is, which package name installed and created a particular package file?

Supposed that you encounter a file name lying a round from some directory and the file looks like unfamiliar to your mind's file list. And you are aware that this file is part of an application package currently installed from your box, and you just can't identify which package name was that file belongs to.

Identify From Which Package Name a File Belongs To

I am taking for an example, say /etc/named.conf . Let us determine which package name this file belongs to. Here's how to accomplish this task, simply issue

# rpm -qf /etc/named.conf
Result:
~~~~~~~~~~~~~~~~~~~~~~~
bind-9.5.0-22.b1.fc8
~~~~~~~~~~~~~~~~~~~~~~~

Another example
# rpm -qf /etc/pango/pangox.aliases
Result:
~~~~~~~~~~~~~~~~~~~~~~~
pango-1.18.3-1.fc8
~~~~~~~~~~~~~~~~~~~~~~~

The command normally shows the package name where the file belongs to and the package version and distro version from which the package was compiled for.

# rpm -qf /etc/sysconfig/netconsole
~~~~~~~~~~~~~~~~~~~~~~
initscripts-8.60-1
~~~~~~~~~~~~~~~~~~~~~~

Sure you get the idea.

Identify From Which Package Name a Directory Folder Belongs To

Now, how to get the package name a folder belongs to you asked? The concept should be the same, using rpm to query the package name a directory folder belongs to? That is, which package created and installed an existing folder from your box?

Some interesting examples.
# rpm -qf /dev/shm
# rpm -qf /var/named/chroot/etc/
# rpm -qf /dev/null

Identify From Which Package Name A Binary is Part of

# rpm -qf /usr/bin/whoami
# rpm -qf `which whoami`
Result:
~~~~~~~~~~~~~~~~~~~~~~~~
coreutils-6.9-12.fc8
~~~~~~~~~~~~~~~~~~~~~~~~

Carry on.

Some Readings:
Kernel Devel Headers HowTo
More Multimedia Plugins HowTo
Fedora and RHEL Differences
Microsoft Fonts on Fedora 8 HowTo
Livna Repository on Fedora 8 HowTo

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy