which package a file belongs to

Matthew Flaschen matthew.flaschen at gatech.edu
Sun Jan 18 11:16:32 UTC 2009


frmas wrote:
> Ansgar Burchardt a écrit :
>>> I'm looking for the tool (dpkg ?) and command line parameters, that will
>>> give me the package (name and version), a file on my HD belongs to.
>>> Something like :
>>> dpkg --search | grep /usr/bin/nedit ??
>>>
>>> Result : nedit_1.5.5-2ubuntu3.deb
>> The command `dpkg -S /usr/bin/nedit' will tell you the package name and
>> then you can use `dpkg -l [package]' to get the installed version.
> 
> yes, that could do the trick.
> I've tried to optimize that, but I failed. I don't know how to get rid
> of those little ":" at the end of the name. This is my command line :
>  dpkg -S /usr/bin/nedit | dpkg -l `awk '{print $1}'`

   dpkg -l `dpkg -S /usr/bin/nedit|sed s/:.*//`

Matt Flaschen




More information about the ubuntu-users mailing list