Welcome, please login or register

Mac OS X commands

Here follows an incomplete collection of a couple Mac OS X commands. Just open up Terminal.app, and try them out.

If you are familiar with UNIX you are lucky since most UNIX commands work.

ifconfig lists the IP address and a lot more network information. To keep the output shorter try ifconfig | grep inet.

locate finds files

pico opens a text editor in the shell

df displays how much free disk space is available

mkdir -p x/y/z creates all directories at once

pkgutil –pkgs list installed packages, to get details use pkgutil –pkg-info <package-name>

!$ refers to the last parameter and can be reused in the next command

find . -name *.xml | xargs grep MyString finds a string “MyString” in files in or below the current dir

find . -type f -print0 | xargs -0 chmod a-w changes write permissions recursively. Works if the files contain spaces slashes etc. Use -type d if you need to change the dirs instead.

Here are some additional commands: http://ss64.com/osx/

Non shell commands:

Capture a screen shot:

  1. To capture the entire desktop, press Command-Shift-3. The screen shot will be automatically saved as a PNG file on your desktop
  2. To copy the entire desktop, press Command-Control-Shift-3. The screen shot will be placed on your clipboard for you to paste into another program.
  3. To capture a portion of the desktop, pressCommand-Shift-4. A cross-hair cursor will appear and you can click and drag to select the area you wish to capture. When you release the mouse button, the screen shot will be automatically saved as a PNG file on your desktop. (The file is saved as PDF in Mac OS 10.3 and earlier.)
  4. More screen shot possibilities: here and here

Show hidden files like files starting with a dot

defaults write com.apple.finder AppleShowAllFiles TRUE

killall Finder

And to revert back set it to FALSE

One Comment

Leave a Reply