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.