Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I want to find out which directory under /usr/ports contains a port like "gnome-terminal", how can I do that? Is there an easy command? At the moment I use things like

echo */gnome-terminal

but is there a website or guide which tells you this without having to use a trick?

share|improve this question
up vote 7 down vote accepted

There are several ways that you can find a port, including your echo technique. To start, there is the ports site where you can search by name or get a full list of available ports. You can also try:

whereis <program>

but this--like using echo--won't work unless you type the exact name of the port. For example, gnome-terminal works fine but postgres returns nothing. Another way is:

cd /usr/ports
make search name=<program>

but keep in mind that this won't return a nice list; it returns several \n delimited fields, so grep as necessary. I've used both of the above methods in the past but nowadays I just use find:

find /usr/ports -name=<program> -print

Lastly, I will refer you to the Finding Your Application section of the handbook which lists these methods along with sites like Fresh Ports which is handy for tracking updates.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.