OSX Command Line

a very useful e-book <<Mac OS X Tiger in a Nutshell>>: http://books.google.ca/books?id=4qniHcvZoCoC&printsec=frontcover

How to automatically mount network share when user login
1. create a automount script, save it, for example, to /usr/local/bin/. and enable to x for it
2. run this command to enable it to run when user login.
   sudo defaults write com.apple.loginwindow LoginHook /usr/local/bin/auto_mount_shares

wireless:
How to get wireless SSID:
    AWK version: /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | awk '/ SSID/ {print $2}'
    SED Version: /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | sed '/ SSID: /!d; s/^.* SSID: //'

How to Change Network Locations:
     Location="Automatic"
     /usr/sbin/scselect "$Location"


pmset

defaults

plutil

scselect:
     scselect -- Select system configuration "location"

SYNOPSIS
     scselect [-n] [new-location-name]

DESCRIPTION
     scselect provides access to the system configuration sets, commonly referred to as "locations".  When invoked with
     no arguments, scselect displays the names and associated identifiers for each defined "location" and indicates
     which is currently active.  scselect also allows the user to select or change the active "location" by specifying
     its name or identifier.  Changing the "location" causes an immediate system re-configuration, unless the -n option
     is supplied.


Edit XML (PList) File:
  a opensource tools: XMLStarlet Command Line XML Toolkit

I/O统计:
iostat [-CUdKIoT?] [-c count] [-n devs] [-w wait] [drives]
    DESCRIPTION: Iostat displays kernel I/O statistics on terminal, device and cpu operations.  The first statistics that are
     printed are averaged over the system uptime.  To get information about the current activity, a suitable wait
     time should be specified, so that the subsequent sets of printed statistics will be averaged over that time.

    EXAMPLES
           iostat -w 1 disk0 disk2
     Display statistics for the first and third disk devices device every second ad infinitum.

           iostat -c 2
     Display the statistics for the first four devices in the system twice, with a one second display interval.

           iostat -Iw 3
     Display total statistics every three seconds ad infinitum.

           iostat -odICTw 2 -c 9
     Display total statistics using the old-style output format 9 times, with a two second interval between each mea-
     surement/display.  The -d flag generally disables the TTY and CPU displays, but since the -T and -C flags are
     given, the TTY and CPU displays will be displayed.

SEE ALSO
     fstat(1), netstat(1), nfsstat(1), ps(1), pstat(8)


原文链接: http://blog.csdn.net/afatgoat/article/details/3354758

你可能感兴趣的:(OSX Command Line)