Whatpackage


From Knoppix Documentation Wiki
Revision as of 03:35, 8 July 2006 by SNIa (Talk | contribs)

Jump to: navigation, search

To find what package a file belongs to I created the following script.

  • There may be a quicker way to do this, please feel free to inform if you find it.

Ensure you are root, and run the following commands

cat > /usr/bin/whichpkg << EOF
#!/bin/bash
echo checking for $1

for package in `dpkg -l | awk '{print $2}'`
{
  for file in `dpkg --listfiles $package 2> /dev/null`
  {
    if echo $file | grep $1
    then
      echo The file is from $package
    fi
  }
}
EOF
chmod 755 /usr/bin/whichpkg

Now that the script is in place, to find the file simply use the command

whichpkg filename

For example, to find out whatpackage /etc/init.d/knoppix-autoconfig comes from you tupe

whichpkg knoppix-autoconfig

This takes some time as it searches everypackage for the result. Hope this helps.

SNIa 03:34, 8 Jul 2006 (GMT)