Skip to main content

Ten OS X Command Line Utilities you might not know

Ten OS X Command Line Utilities you might not know about

terminal.jpg

The Mac OS X command line interface is home to thousands of programs that the average user doesn’t know exists. Leveraging years of hard work by the GNU foundation and others in the open source community, Apple designed a wonderful OS that doesn’t “need” any use of the command line. While using the command line in Mac OS X is not necessary for the every day operation of a Macintosh, if harnessed correctly, it can save you a lot of time, and occasionally give you a laugh. I hope you enjoy these ten OS X command line utilities!


Update: There is also a Chinese version of this article available here, translated by Klaith. Thanks Klaith!

1. ssh
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!

2. top
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.

3. lsbom
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.

4. say
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”.

5. softwareupdate
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”.

6. ifconfig
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.

7. lipo
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:
cd /Applications
lipo Stickies.app/Contents/MacOS/Stickies -thin i386 -output Stickies.app/Contents/MacOS/Stickies.i386
cd Stickies.app/Contents/MacOS/
rm Stickies
mv Stickies.i386 Stickies

8. screencapture
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!

DarwinPorts Home
Fink – Home


Source: http://osxdaily.com/2006/11/22/ten-os-x-command-line-utilities-you-might-not-know-about/


Comments

Popular posts from this blog

Cisco Command "Auto secure"

Cisco Command "Auto secure" In today's article, I'm going to quickly inform you about the Privileged EXEC command named "auto secure". Network administrators (like you) use the "auto secure" command to secure the management and forwarding planes of a router. Another way of saying it is, CCNAs use this command to secure a router by disabling common IP services which can be exploited by attackers to initiate network attacks. When the command is typed on a router, it takes the user (ccna) through a command line-interface (CLI) semi-interactive session (which is also known as the AutoSecure dialogue). Below is the command's syntax: auto secure [management | forwarding] [no-interact | full] [ntp | login | ssh | firewall | tcp-intercept] As you can see, the command can use several "optional" keywords: management - This (optional) keyword is used to only secure the management plane of a router. forwarding - This (optional) keyword is used to...

NetSurveyor :: 802.11 (WiFi) Network Discovery / Scanner Tool

NetSurveyor :: 802.11 (WiFi) Network Discovery / Scanner Tool http://www.performancewifi.net/performance-wifi/main/NetSurveyor.htm NetSurveyor is an 802.11 (WiFi) network discovery tool and, as such, its goal in life is to gather information about nearby wireless access points in real time and display it in a useful way. Similar in purpose to NetStumbler , it includes many more features. The data is displayed using a variety of different diagnostic views and charts. Data can be recorded for extended periods and played-back at a later date/time. Also, reports can be generated in Adobe PDF format. Applications for NetSurveyor include the following: During the installation of a wireless network, as an aid in verifying the network is properly configured and antennas are positioned at locations to achieve efficient transmission / reception -- that is, for use in verifying WiFi coverage and maximizing beacon signal strength Trouble-shooting an existing network or wireless environm...

The Seven Habits

The Seven Habits Habit 1: Be Proactive - Changes starts form within; highly effective people make the decisions to improve their lives through the things that they can influence rather than simply reacting to external forces. Habit 2: Begin with the end with mind. - Develop a principle– centered personal mission statement into long- term goals based on personal principle. Habit 3: Put first thing first. - Spend time doing what fits into your personal mission, observing the proper balance between production and building production capacity. Identify the key roles that you take on in life, and make time for each other. Habit 4: Think win / win - Seek agreements and relationships that are mutually beneficial. In cases where a win / win deal cannot be achieved, accept the fact that agreeing to make “no deal”, may be the best alternative. In developing the organizational culture, be sure to reward win / win behavior among employees and avoid inadvertently rewarding win / lose behavior. Habi...