Network troubleshooting often requires examining a computer's network settings and possibly making changes to them to test various theories about what may be wrong. The networksetup tool lets you view all manner of network parameters, including IP addresses, available network interfaces, and more than 50 other variables. One setting you probably have to verify frequently is the list of DNS servers, especially in light of the recent malware that changed this list to point to malicious DNS servers. You can also turn Wi-Fi off or on.
The other 49 variables are assigned as homework; here's the variable to display the list of name servers in use for an interface (in this case, Ethernet):
$ networksetup -getdnsservers ethernet
It might display:
68.238.64.12
68.238.128.12
8.8.8.8
4.2.2.1
And to turn Wi-Fi on or off:
$ networksetup -setairportpower airport on
$ networksetup -setairportpower airport off
9. open: Launch applications and open Finder windows from the command line
One of OS X's most versatile commands, open facilitates smooth interaction between a command-line shell and the Mac's graphical user interface. From the command line, you can open a directory into a Finder window, open a document into an application, open a text file into a text editor for quick changes, and more.
To open a directory in a Finder window:
$ open /Users/mel/Documents
Open an application (case doesn't matter):
$ open itunes
To open a document in its default application for file type:
$ open Documents/myword.doc
To open a document in an application other than the one for file type:
$ open -a bbedit junko.txt
To open a file in TextEditor:
$ open -e mytext.rtf
To open a URL in the default browser:
$ open http://google.com
10. opendiff: Compare and merge files and directores
opendiff takes two file or directory names as arguments and passes them to the little-known (because it's hidden) FileMerge utility in OS X's Utilities folder. FileMerge can find the differences between two text files, as well as compare two directories with the ability to merge them into a single directory that eliminates duplicate files. The syntax is simple and produces the display shown below:
$ opendiff Contract1.rtf Contract2.rtf
The top command sorted by CPU percentage
11. pgrep and pkill: Find or signal a program or processby name


















