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
How to install kismet on MacBook, Mac OS X 10.5.6 Leopard How to installed and run kismet. cd /tmp svn co https://www.kismetwireless.net/code/svn/trunk kismet-devel cd kismet-devel ./configure sudo make install Edit kismet config file like: sudo vim /opt/local/etc/kismet.conf and change the following two lines: a.) suiduser=Your_Username_For_Mac b.) source=darwin,en1,airport_extreme Run kismet and enjoy! sudo kismet

What's the difference between 802.11a, 802.11b, and 802.11g?

What's the difference between 802.11a, 802.11b, and 802.11g? The first difference is that 802.11a uses the 5GHz radio frequency (RF) spectrum while 802.11g and 802.11b share the 2.4GHz spectrum. Therefore 802.11a will not interfere with 802.11g or 802.11b. Since 802.11a uses the 5GHz spectrum, it will have less distance capabilities due the physical nature of electromagnetic radiation. 802.11b and 802.11g use an RF spectrum that allows for 3 non-interfering channels (in North America). 802.11a uses a wider spectrum that allows for 12 non-interfering channels which will be 23 non-interfering channels with soon to be released standard. The idea of non-interfering (or non-overlapping) channels allows more wireless users to be concentrated in an area without having to share the transmission medium. 802.11b, while sharing the same 2.4GHz frequency spectrum as 802.11g, has lower transmission rates and different modulation techniques than 802.11g. For a discussion of transmission ra