Difference between revisions of "Whatpackage"
From Knoppix Documentation Wiki
| Line 7: | Line 7: | ||
#!/bin/bash | #!/bin/bash | ||
echo checking for $1 | echo checking for $1 | ||
| − | + | ||
for package in `dpkg -l | awk '{print $2}'` | for package in `dpkg -l | awk '{print $2}'` | ||
{ | { | ||
| Line 14: | Line 14: | ||
if echo $file | grep $1 | if echo $file | grep $1 | ||
then | then | ||
| − | echo $package | + | echo The file is from $package |
fi | fi | ||
} | } | ||
Revision as of 03:35, 8 July 2006
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)