Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Ubuntu User (http://www.linux-archive.org/ubuntu-user/)
-   -   which package a file belongs to (http://www.linux-archive.org/ubuntu-user/229577-package-file-belongs.html)

frmas 01-17-2009 08:47 PM

which package a file belongs to
 
Hello,

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

Thank you. Francois
--

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Ansgar Burchardt 01-17-2009 08:56 PM

which package a file belongs to
 
Hi,

frmas <frmas@free.fr> writes:
> 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.

Regards,
Ansgar

--
PGP: 1024D/595FAD19 739E 2D09 0969 BEA9 9797 B055 DDB0 2FF7 595F AD19


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Charlie Kravetz 01-17-2009 08:57 PM

which package a file belongs to
 
On Sat, 17 Jan 2009 22:47:10 +0100
frmas <frmas@free.fr> wrote:

> Hello,
>
> 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
>
> Thank you. Francois

I don't know if this is what you want, but try
apt-cache policy nedit
in a terminal.

Good luck,

--
Charlie Kravetz
Linux Registered User Number 425914 [http://counter.li.org/]
Never let anyone steal your DREAM. [http://keepingdreams.com]

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Mario Vukelic 01-17-2009 09:11 PM

which package a file belongs to
 
On Sat, 2009-01-17 at 22:47 +0100, frmas wrote:
>
> 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.

dpkg -S <package>

See the man page of dpkg for details.


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Mario Vukelic 01-18-2009 08:48 AM

which package a file belongs to
 
On Sat, 2009-01-17 at 23:11 +0100, Mario Vukelic wrote:
> dpkg -S <package>

Um no, it is of course "dpkg -S <file>", as Ansgar wrote in the other
reply.


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

frmas 01-18-2009 09:11 AM

which package a file belongs to
 
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}'`
but awk returns "nedit:" ;-(
I do not know how to remove those ":".... Francois

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Matthew Flaschen 01-18-2009 10:16 AM

which package a file belongs to
 
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

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Nils Kassube 01-18-2009 10:26 AM

which package a file belongs to
 
frmas wrote:
> 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}'`
> but awk returns "nedit:" ;-(
> I do not know how to remove those ":".... Francois

How about this?

dpkg -S /usr/bin/nedit|dpkg -l $(cut -f1 -d':')


Nils

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Matthew Flaschen 01-18-2009 10:31 AM

which package a file belongs to
 
Nils Kassube wrote:
> frmas wrote:
>> 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}'`
>> but awk returns "nedit:" ;-(
>> I do not know how to remove those ":".... Francois
>
> How about this?
>
> dpkg -S /usr/bin/nedit|dpkg -l $(cut -f1 -d':')

Doesn't work. But:

dpkg -l `dpkg -S /usr/bin/nedit|cut -f1 -d':'`

would.

Matt Flaschen

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

frmas 01-18-2009 10:58 AM

which package a file belongs to
 
Matthew Flaschen a écrit :
> Nils Kassube wrote:
>> frmas wrote:
>>> 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}'`
>>> but awk returns "nedit:" ;-(
>>> I do not know how to remove those ":".... Francois
>> How about this?
>>
>> dpkg -S /usr/bin/nedit|dpkg -l $(cut -f1 -d':')
>
> Doesn't work. But:
>
> dpkg -l `dpkg -S /usr/bin/nedit|cut -f1 -d':'`

Thank you to all of you. Time to share my work. From your posts, I wrote
that litte script I placed in my /usr/local/bin directory. That way I
can run it against a file without all the stuff to type (and remember)
each time :-)

This is it. Save it, chmod to 755 and voila. I would be pleased if some
of you could improve it.

>----------------------cut here --------------------------------
#!/bin/bash

startScript() {
case $1 in
--{$1} | -{$1})
TYPE="itsok"
;;
--help | -help | -H | --H | -h | --h)
echo ""
echo "Usage: "$0 --file_searched" - file_searched
as to be replaced with the path and name file."
echo ""
exit;;
*)
esac

if [[ $1 = "" ]] ; then
clear
echo "*************Warning***Warning***Warning********* ****"
echo "* *"
echo "* Run that script with a parameter as : *"
echo "* "paquet /usr/bin/nedit" *"
echo "* *"
echo "***Warning*************Warning*************Warnin g***"
exit 1
else
clear
echo ""
clear
echo "."
read -t 1
clear
echo ".."
read -t 1
clear
echo "..."
fi
}

startScript $1

dpkg -l `dpkg -S $1|sed s/:.*//`

exit
>----------------------cut here --------------------------------

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


All times are GMT. The time now is 07:15 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.