Before you can install any applications you need to know what you want, and what the application is called.
FreeBSD's list of available applications is growing all the time. Fortunately, there are a number of ways to find what you want:
The FreeBSD web site maintains an up-to-date searchable list of all the available applications, at http://www.FreeBSD.org/ports/. The ports are divided into categories, and you may either search for an application by name (if you know it), or see all the applications available in a category.
Dan Langille maintains FreshPorts, at http://www.FreshPorts.org/. FreshPorts tracks changes to the applications in the ports tree as they happen, allows you to “watch” one or more ports, and can send you email when they are updated.
If you do not know the name of the application you want, try using a site like Freecode (http://www.freecode.com/) to find an application, then check back at the FreeBSD site to see if the application has been ported yet.
If you know the exact name of the port, but just need to find out which category it is in, you can use the whereis(1) command. Simply type whereis file, where file is the program you want to install. If it is found on your system, you will be told where it is, as follows:
# whereis lsof lsof: /usr/ports/sysutils/lsof
This tells us that lsof (a system utility) can be found in the /usr/ports/sysutils/lsof directory.
Additionally, you can use a simple echo(1) statement to find where a port exists in the ports tree. For example:
# echo /usr/ports/*/*lsof* /usr/ports/sysutils/lsof
Note that this will return any matched files downloaded into the /usr/ports/distfiles directory.
Yet another way to find a particular port is by using the Ports Collection's built-in search mechanism. To use the search feature, you will need to be in the /usr/ports directory. Once in that directory, run make search name=program-name where program-name is the name of the program you want to find. For example, if you were looking for lsof:
# cd /usr/ports # make search name=lsof Port: lsof-4.56.4 Path: /usr/ports/sysutils/lsof Info: Lists information about open files (similar to fstat(1)) Maint: [email protected] Index: sysutils B-deps: R-deps:
The part of the output you want to pay particular attention to is the “Path:” line, since that tells you where to find the port. The other information provided is not needed in order to install the port, so it will not be covered here.
Alternatively, there is another search feature from ports that achieves the same purpose but with less noise, the quicksearch feature. This feature accepts the same parameter as the search feature. For example, searching for lsof would return:
# cd /usr/ports # make quicksearch name=lsof Port: lsof-4.87.a,7 Path: /usr/ports/sysutils/lsof Info: Lists information about open files (similar to fstat(1))
For more in-depth searching you can also use make search key=string or make quicksearch key=string, where string is some text to search for. This searches port names, comments, descriptions and dependencies and can be used to find ports which relate to a particular subject if you do not know the name of the program you are looking for.
In both of these cases (search and quicksearch), the search string is case-insensitive. Searching for “LSOF” will yield the same results as searching for “lsof”.