Opkg: how to get a single file in search?

Sometimes is not easy to know name of package which contain an executable

On Debian I use apt-file, on Rocky Linux dnf provides

And with opkg?

I have tried

opkg find '*sdiff*'

but return only packages which contain sdiff in name, I need the package which contain *bin/sdiff file.
How to do?

Did you try the search command?

search <file|regexp>	List package providing <file>
1 Like

Yes for example

opkg search *bin/dig

Return nothing, I need "dig" file, but I dont' know the exact path.

Run which dig ?

Sure it doesn't ship with BusyBox ?

1 Like

Seems to work as expected:

$ opkg search '*/ip-tiny'
ip-tiny - 6.11.0-r1

Also dig seems to be in bind-dig.

1 Like

I don't know if opkg can tell you what package in the repository would install a particular file but I happen to have sdiff installed and found the package via:

which sdiff
/usr/bin/sdiff

and

grep "sdiff" /usr/lib/opkg/info/*
/usr/lib/opkg/info/diffutils.list:/usr/bin/sdiff

indicating the package that did install that file is diffutils.

I hope that is some help.

EDIT: Be sure your opkg cache is up to date with opkg update before trying to use opkg tools like find or install.

3 Likes
opkg install busybox
Package busybox (1.36.1-r2) installed in root is up to date.
root@OpenWrt:~# which dig
root@OpenWrt:~#

Like I said above:

1 Like

Thanks for bind-dig, for opkg search look

root@OpenWrt:~# opkg search '*/ip-tiny'
root@OpenWrt:~# 

Did you do opkg update before that?

2 Likes

It is looking like opkg search finds items that are installed.

ip-tiny is a package name so opkg find ip-tiny should find it if your cache is up to date and it is available for your system and it isn't missing due to a build problem or ...

1 Like

sure i did it
but don't found ip-tiny, but this works

opkg search '*/bin/dig'
bind-dig - 9.20.4-r1

Thanks

Solution found
Thanks to user Dante and others for helping

opkg update
opkg search '*/bin/dig'
bind-dig - 9.20.4-r1