Wednesday, January 10, 2007

Determine Which Package a Particular File Belongs To - (Sun Solaris)

by Jeff Hunter, Sr. Database Administrator


Use the pkgchk command to determine which package a particular file belongs to. The syntax is:

# /usr/sbin/pkgchk -l -p /absolute/path/todir

For example,

# /usr/sbin/pkgchk -l -p /usr/bin/pgrep Pathname: /usr/bin/pgrep Type: regular file Expected mode: 0555 Expected owner: root Expected group: bin Expected file size (bytes): 14688 Expected sum(1) of contents: 63968 Expected last modification: Mar 16 05:53:45 AM 2000 Referenced by the following packages:         SUNWcsu Current status: installed

You can also simply query the packages directory as follows:

# grep /usr/bin/pgrep /var/sadm/install/contents /usr/bin/pgrep f none 0555 root bin 14688 63968 953204025 SUNWcsu

No comments: