Search software

If you want to search a specified application, you can use “pkg search“ command. For example:

  1. # pkg search lsof
  2. lsof-4.90.b,8 Lists information about open files (similar to fstat(1))
  3. p5-Unix-Lsof-0.0.5_2 Unix::Lsof -- a wrapper to the Unix lsof utility

If you want to know the software’s path in the ports tree, you can use -o option:

  1. # pkg search -o lsof
  2. sysutils/lsof Lists information about open files (similar to fstat(1))
  3. sysutils/p5-Unix-Lsof Unix::Lsof -- a wrapper to the Unix lsof utility

In case the Ports Collection is already installed, you can employ whereis command:

  1. # whereis lsof
  2. lsof: /usr/local/sbin/lsof /usr/local/man/man8/lsof.8.gz /usr/ports/sysutils/lsof

Another tricky method is using “echo“ command:

  1. # echo /usr/ports/*/*lsof*
  2. /usr/ports/distfiles/lsof_4.90B.freebsd.tar.bz2 /usr/ports/sysutils/lsof

Reference:
Finding Software.