juretta.com

Mac OS X command line goodies

February 04, 2007
Bash Mac Unix

Mac OS X has several command line programs you maybe unaware of. Here are a few that are worth knowing of.

Command+Shif+4 or Command+Shift+3 are the built in commands to capture the current screen (3) or parts of the screen (4). With screencapture you can use this facility using the command line.

The command open opens files and directories.

The command pbcopy and it's sibling pbpaste open up the Mac OSX clipboard for your command line programs. Select some text in your browser, press Command+C and you can print the content of the clipboard with pbpaste.

To put some text into your clipboard you can use pbcopy. The following command reads the /etc/motd file (motd stands for message of the day, this is what you can see when opening a terminal - on Mac OS X its usually "Welcome to Darwin") and puts it's content into the clipboard.

Are you using Ruby? Do you have RubyGems installed? You might want to consider installing the attachr gem (sudo gem install attachr). You can save text snippets to attachr.com from your commandline.

With lsbom you can examine the contents of a Mac OS X installer (.pkg).

lipo is a tool to operate on universal binary files. You can get detailed info on a universal file by using lipo -detailed_info /path/to/binary

The system_profiler command reports system hardware and software configuration. The following example prints the hardware configuration.

softwareupdate installs system software updates from apple.

You might know how to use the find command to search for files. It's mac specific sibling mdfind is using the Spotlight metadata repository to find files. To list the metadata for a specific file you can use the mdls command.

The last command convert[s] text to audible speech. See man say for more information to use say.


About

This is the defunct blog of Stefan Saasen.

Ads