6. locate: Quickly search file and folder names
The locate utility searches a special internal database of all publicly accessible pathnames that OS X maintains separately from the Spotlight search index. It's very fast to search, but the database is refreshed only periodically -- typically daily.
The first time you run the command, you may receive a warning that the database doesn't exist. The warning message will tell you the name of the command to activate locate's database and begin building it, a process that may take several hours. Once built, however, the database is quick and easy to search when you're trying to track down a folder, file, or application. Simply type the string you're searching for after the command name. Type man locate for full details on search syntax.
$ locate junko
7. lsof: Reveal open TCP and UDP ports and the applications using them
When tracking down problems, particularly security-related issues, it's often helpful to know which applications are currently communicating on the network. The lsof (list open files) command does that. With the -i option, it lists all the open connections in progress and the names of the applications using them. The list can be long, and often you're only interested in applications that have established sessions, not partially open ones (for example, someone trying to sign on). To reduce the command's output, you can pipe it to the grep command and filter on the word ESTABLISHED to list only functional connections:
$ lsof -i | grep ESTABLISHED
It might display:
ScreenShare 865 adm ... TCP 10.0.0.48:64603->www.sbwh.net:ssh (ESTABLISHED)
ScreenShare 866 adm ... TCP 10.0.0.48:26164->www.sbwh.net:ssh (ESTABLISHED)
JobServ 922 adm ... TCP 10.0.0.48:64701->renite.jobserv.com:ftp (ESTABLISHED)
aosnotify 1101 adm ... TCP 10.0.0.48:50129->aosnotify.me.com:5223 (ESTABLISHED)
Mail 7601 adm ... TCP 10.0.0.48:53529->supersonic.jet.net:https (ESTABLISHED)
8. networksetup: Retrieve or set network configuration values