Mac OS X Command Line Utilities
It is always wise to keep your system up-to-date all the time. Sure you can get updates for your Apple software by using Software Update from the Apple menu. But what if you tend to use the Terminal for running most of your commands? To start the process of update, go to the Terminal and use the quick and easy command “softwareupdate –i -a" to download and install updates from Apple.
Mac OS X includes its own version of the ssh command, called OpenSSH so you don’t need any third-party software. The main use of this command is secure remote administration. For example, if you wish to enable Mac OS X’s built-in SSH server, you would open the System Preferences, go into Sharing and check the box beside Remote Login. But if you are away from your home base and wish to access your machine, you can use "ssh" from your Mac OS X terminal window to connect to the IP address of your Mac computer. Once connected, you can use your username and password to login your machine and access it. There are many other uses of ssh for example, you can use ssh to browse Web securely in the public areas, transfer files, execute commands, etc.
“Top" is a great utility that has been in use by Unix/Linux users for a very long time. With the “top" utility, you can see a list of every process that is currently running on your Mac OS X. This tool can be very useful at the time of troubleshooting problems in Mac OS X. The “top" command updates every five seconds, which can be helpful in finding what’s going on in the system.
To run “top", open Terminal from Application -> Utilities ->. When the terminal window opens, type “top" to see the results.
With lsbom, you can examine the content of any Mac OS X installer – the .pkg file and get a complete view beforehand of what is going to be installed on your system. You might like to download apps for your Mac OS X from wherever you find them on the Internet. There, this tool comes in use, which shows you a complete picture of the installer before its installation.
To use lsbom, open the Terminal (go to Applications -> Utilities -> Terminal) and then go the location in the system where the .pkg file resides. Then type “lsbom .pkg/Contents/Archive.bom> | more" and press Enter. You will see a listing of all the files your new program will install.
Screen capture is of course a very useful feature that virtually every computer user uses. In Mac OS X, there is a command “screencapture" that offers a more advanced way to take screen captures. To use it, open your Terminal window and then type “screencapture –iW ~/Desktop/yourCapture.jpg". Hit the Enter key and you will see a camera icon on the screen. Place the camera icon on whatever window you want to capture and the do a single click. It will create a file on your desktop called “yourCapture.jpg", which will contain a snapshot of your screen capture. If you wish to take a snapshot of the entire screen, type in “screencapture –S ~/Desktop/fullScreen.jpg", press Enter. You can also take a snapshot of a section of your screen by typing “screencapture –ic".
Have you ever found yourself with a CD-ROM stuck in your CD-Drive but no way to eject it? It did not show up either in the Finder or on the Desktop and the Eject button on the keyboard also didn’t help? There is an easy way out from this problem with a Command Line command. Open up the Terminal window and type “disktool" to get help on using this command. Use the command like this to eject your disk:
disktool –e disk# (# is disk number, which you will get by entering disktool –l)
If you want your Mac to speak then try the “say" command, which is unique to Mac OS X. To use this command, open the Terminal window and type something, for example type “say hello world" and press Enter, your Mac will say “Hello World". Mac includes a number of female and male voices. To change the voice, type the command like this:
say -v Victoria "Voice of Victoria".
Other available mail and female voices are Agnes, Kathy, Vicki, Fred, Bruce, Ralph and Junior
You can find your system’s IP information by using the System Preferences window but it is much quicker to do this with the “ifconfig" command. To use “ifconfig", open up Terminal window and type in “ifconfig" then hit the Enter key. You will see detailed information on the screen about your network card’s MAC Address. With ifconfig, you can also find configure and control TCP/IP network interface. Its one of the common uses include setting your network card’s IP address, enabling and disabling it.