Take a look at https://freshports.org, there is a very nice filtering system to specify what you are looking for.
To do this from the command line, you are looking for the -S
flag and options.
By default, pkg
searches on the pkg-name
. Meaning, if you type pkg search webserver
it will look for a package with webserver
in the name. As you probably ran into, this cant find many webservers. Matter of fact, for me, it returned 0 results. The -S
flag allows us to specify if we wish to search by pkg-name
, description
, comment
, name
, or origin
.
Using this, a command of pkg search -S description "web server"
returns WAY more info. More than I believe you are looking for. This will display the ENTIRE description for every pkg with web server
in it. So lets say we want to search for all packages that are described as "web servers", but only return the names of those packages. We can apply an additional flag -L
which can compact it to just the pkg name.
Below is a cleaner option, probably what you are looking for.
pkg search -S description -L name "web server"
NOTE: -S
and -L
are case-sensitive, refer to pkg help search
command for more details.
If you run into issues, always always refer to the documentation and man pages!
I hope this helps and informs others as well.