# How to find which package provides a specific file or library in Freebsd 11.3



## Aruns (Apr 21, 2021)

How to find which package provides a specific .so file or library in Freebsd 11.3?
I want to find the package of few .so files, which are part of a .tgz file build on FreeBSD11.3 using pyinstaller.
for instance, libkvm.so.7 is one .so file found in my .tgz file. i want to understand the which package it belongs to. I guess, there should be some command for the same
Thanks in advance


----------



## richardtoohey2 (Apr 21, 2021)

I think you want _pkg which_ ... but I'm not entirely sure how to use it!


----------



## bakul (Apr 21, 2021)

libkvm.so.7 is a kernel memory interface and provided by the system but in general you can try *pkg which* _<file-path>_. You can also try *pkg list | grep* _<regexp>_ if you don't know the exact path. If neither yields anything, likely it is part of the FreeBSD distribution or something installed manually. Another hint: if you have a library lib_<foo>_.so.x, check if there is a man page by doing *man* _<foo>_ or *apropos* _<foo>._


----------



## tingo (Apr 21, 2021)

pkg which example:

```
tingo@kg-core2$ pkg which `locate libkvm.so.7`
/lib/libkvm.so.7 was not found in the database
/usr/lib32/libkvm.so.7 was not found in the database
```
Anything installed via ports / packages should be under /usr/local/.. so if it isn't it is part of the base system (or someone installed manually and didn't follow the rules ..)
A better example:

```
tingo@kg-core2$ pkg which `locate libssl.so.11`
/usr/local/lib/libssl.so.11 was installed by package openssl-1.1.1k_1,1
```
Hope this helps.


----------

