By: Leo D'Adderio
Date Submitted: 2010-04-13
This little gem is included in every version of Mac OS X. Originally developed as drop-in replace to the rsh/rlogin programs, ssh has become a staple of the Linux/Unix(and now Mac OS X) community. Openssh’s primary use is secure remote administration. If you wish you enable Mac OS X’s built in SSH server you can do so by opening your System Preferences , clicking on “Sharing” and checking the box next to “Remote Login”. Now if you are on the road and wish to access your machine you can use a client like PuTTY (from a windows machine) or “ssh” from a Mac OS X terminal window and connect to the IP address of your Mac. After logging in with your Username and Password you will be presented with complete access to the Mac OS X command line. Openssh has many, many more uses some of which are quite advanced. My personal favorite is using ssh as a SOCKS server to browse the web securely in public internet locations.
Check out this page for more ways to use ssh on a Mac!
Top is another classic utility that has long been in use by the Linux/Unix community. To use top, open a Terminal.app and type “top”. In less time it takes to blink you eye you should be presented with a window full of text. What you see is a list of every process currently running on your Macintosh. When my Mac is running slow, top is the first resource I use to figure out whats going on.
For a complete overview of top click here.
lsbom is great for that paranoid voice in your head that you often times hear before you go and install some cool new utility you’ve found on a random Mac blog (like osxdaily). With lsbom you can examine the contents of a Mac OS X installer (.pkg) and get a very detailed view of what is about to be placed into your Mac’s precious filesystem. To use lsbom, open up the Terminal.app and navigate to the place in your filesystem where the .pkg file resides. If your installer came on a .dmg, it might help to copy the .pkg to your desktop, and then cd ~Desktop. Once you have found where your .pkg resides, type “lsbom .pkg/Contents/Archive.bom> | more” and voila! You will see a complete list of files your new program wishes to install.
Now this command is unique to Mac OS X, and offers more fun than anything else. Try it out by opening Terminal.app and typing “say hello”.
The “softwareupdate” command is a quick and easy way to install software updates from apple. To use it, open up Terminal.app and type “softwareupdate -i -a” to install all available updates for your Macintosh. If you wish to only install “recommended” updates type “softwareupdate -i -r”.
The quickest, easiest way to figure out what ip address your Mac is using, is definitely “ifconfig”. To use ifconfig, open up Terminal.app, and type “ifconfig”. You will see a lot of information, including your network card’s MAC Address. I like to type “ifconfig | grep inet” to return just the ip information for my computer. You can disable a network interface (in this example “en0″) by typing “ifconfig en0 down”. You could bring back up with “ifconfig en0 up”. This can be much quicker than using the System Preferences window.
lipo (aptly named) is a utility that manipulates universal binaries in Mac OS X. A lot of (almost all) programs these days ship, or download as “Universal”, meaning they have binary code that both the powerpc and the intel chips can understand. But since you probably don’t care about one of the two, you want to use lipo to “thin” down your binaries. For example if you wanted to thin the “Stickies” application to only contain intel (i386) code:
lipo Stickies.app/Contents/MacOS/Stickies -thin i386 -output Stickies.app/Contents/MacOS/Stickies.i386
mv Stickies.i386 Stickies
screencapture offers a more advanced way (over command-shift-3) to take screen captures. To use it, open up your Terminal.app and try typing screencapture -iW ~/Desktop/screen.jpg. It will bring up a camera icon that is waiting to be clicked on a window. Once clicked, a file on your desktop called “screen.jpg” will be created that will contain a snapshot of whatever window you clicked on. You can of course, also take a snapshot of your entire screen by typing screencapture -S ~/Desktop/screen.jpg. If you really feel like being particular you can snag just a portion of your screen by typing screencapture -ic. Now go get some screenshots and send them over to osxdaily, we love ‘em!
9 & 10. fink and darwinports
If you’ve had your fill with the base set of OS X command line utilities, its time to open your Terminal.app’s eyes to the rest of the oppen source world. Using darwinports or fink you can download and install hundreds of free open source applications to your computer. I have found that darwinports tends to have some of the more obscure open source projects, but fink seems to be rock solid. You can install them at the same time if you REALLY know what you are doing, but generally I would have to advise that you pick one or the other. Novice users may want to try out fink, as it ships with a program called Fink Commander which gives you point and click access to its repository of software. Check it out!