General Commands

dmesg - Display the startup messages.

ifup - Displays whether the device passed is functioning.

Usage: ifup <device name>

Example: ifup eth0

network - Executes a network command.

Usage: network <command>

Example: network restart

tcpdump - Displays all traffic being sent or received on all tcp ports.

top - Displays a list of all running processes and info asscociated with each.

lynx 'address'

Show the web page at address with a text-mode web browser.

pine

Read and send mail using pine.

who

Lists current users on the system.

who am i

Displays listing for this session.

 

OS X Commands

 

Set environment variables via a plist file in the user's home folder at login:

Example:

~/.MacOSX/environment.plist

Set key/value pairs in this file as env variables.

 

Force the Finder to display all invisible UNIX files and dirs:

defaults write com.apple.Finder AppleShowAllFiles true

 

Disable spotlight indexing of drives:

1) Using the mdutil command-line utility in Terminal, turn off indexing for each of your drives. example:

$ sudo mdutil -i off /Volumes/your_hard_drive_name_1
$ sudo mdutil -i off /Volumes/your_hard_drive_name_2

2) Then use mdutil to remove the indexes from each drive

$ sudo mdutil -E /Volumes/your_hard_drive_name_1
$ sudo mdutil -E /Volumes/your_hard_drive_name_2

3) Physically remove the .Spotlight directories from the root of each drive.

$ cd /
$ sudo rm -fr .Spotlight-V100

 

Show only active apps in the Dock:

defaults write com.apple.dock static-only -bool TRUE

 

defaults write com.apple.dashboard mcx-disabled -boolean YES

When finished, in Terminal type killall Dock. This kills the Dashboard and restarts the Dock.

To restart Dashboard:

defaults write com.apple.dashboard mcx-disabled -boolean NO

killall Dock

 

To enable or disable additional logging by Installer.app:

defaults write com.apple.installer DebugChoiceAttrEngine -bool YES
defaults delete com.apple.installer DebugChoiceAttrEngine

 

sudo fs_usage -w -f filesys <Application Bundle Name>

View all filesystem commands that an app uses.

 

launchctl unload -w ~/Library/LaunchAgents/com.afp548.mover.plist

Disable Bonjour

 

% sudo /usr/sbin/gcc_select 3.3

Set the default compiler to be gcc 3.3.

% sudo /usr/sbin/gcc_select 4.0

Set the default compiler to be gcc 4.0.

 

sudo fixPrecomps -all

Rebuilds all of Project Builder's precompiled headers for MacOS X.

 

CpMac old new

Copies a Macintosh file with resource forks from file old to file new.

 

mvMac old new

Moves the Macintosh file old including resource forks to file new.

 

enscript option(s) file(s)

Translate text file(s) file(s) from text to PostScript™.

 

lpr option(s) files

Send files file(s) to the default printer.

 

atlookup

List all AppleTalk devices on a network.

 

kextstat

List all KEXTs running on the system.

The following is a list of the mount points for the different Mac OS X systems:


Mac OS X 10.3.4 and before:
-fstab -mnt /private/var/automount/Network/Servers
-static -mnt /private/var/automount

Mac OS X 10.3.5 to 10.3.9:
-fstab -mnt /private/Network/Servers
-static -mnt /private/automount

Mac OS X 10.4:
-fstab -mnt /private/Network/Servers
-static -mnt /private/var/automount

Mac OS X 10.6:

To extract the set of localizable strings from your nib file, you use a command similar to the following in Terminal:

ibtool --generate-stringsfile MyNib.strings MyNib.nib

The --generate-stringsfile option causes ibtool to parse the specified nib file and generate a strings file containing all of the strings that should be localized, including things such as control titles, tool tips, placeholder text, and accessibility information. The strings file is written out using the UTF-16 encoding, which is the recommended encoding for strings files. For each entry, the file includes comments indicating the object that contains the string, the object’s ID, and the current string if one is set.
After you translate the exported strings, you use ibtool to merge the translations back into your nib file. In Terminal, you should invoke ibtool using a command similar to the following:

ibtool --strings-file MyNib.strings --write MyNewNib.nib MyNib.nib

 

strip -S <filename>

Strips all debugging information but not function names from binary program file filename. Can drastically reduce the size of Applications on disk. Run this command on the actual executable inside Contents/MacOS directory of the application package.

Fixing file Carriage Returns

Edit .tcshrd the tcsh configuration file:

% vi ~/.tcshrc

Add the following lines anywhere in the file:

alias m2u tr " '\015' '\012' "

alias u2m tr " '\012' '\015' "

To fix a Mac-format file from UNIX:

% m2u < mac-format-file > unix-friendly-file

To fix a UNIX file from a Mac tool:

% u2m < unix-friendly-file > mac-format-file

tr translates occurences of one character to another.

 

convert an app's sources to framework-style notation:

$ cd /Volumes/Sources/MyApp
$ find -X . -type f | xargs -t tops -scriptfile /Developer/Headers/FlatHeaderConversion/Carbon.tops
$ find -X . -type f | xargs -t tops -scriptfile /Developer/Headers/FlatHeaderConversion/QuickTime.tops
$ remove_duplicate_includes.pl -r .

 

Red Hat Linux-only commands

redhat-config-network - Runs RH text-based network configuration.

If you have your own UNIX commands to add, send me an email and I will include them.