# set long listing
alias ll='ls -al | more' 
#fedora larry/bird*shit 

#open man page in Preview
#man -t whatever | open -f -a /Applications/Preview.app
#alias pman='man -t !:* | open -f -a /Applications/Preview.app'

# find dhcp server - en0 for ethernet
ipconfig getpacket en1
server_identifier (ip): That's your DHCP server's IP address.
yiaddr: Your machine's IP address.
chaddr: Your machine's MAC address.
domain_name_server: Your domain name server(s).

#change login window users
sudo defaults write /Library/Preferences/com.apple.loginwindow \
HiddenUsersList -array-add account1 account2 account3
#to change later edit, with PLE
com.apple.loginwindow.plist 

#to add quit to finder
defaults write com.apple.Finder QuitMenuItem -bool Yes

#disable spotlight
sudo mdutil -i off /Volumes/your_hard_drive_name_1
#remove indicies from each drive
sudo mdutil -E /Volumes/your_hard_drive_name_1
#remove spotlight dirs from root of each drive
cd /
sudo rm -fr .Spotlight-V100
#turn spotlight back on
sudo mdutil -i on /Volumes/your_hard_drive_name_1
#pmset -g  ; power mgmt

#cancel all pring jobs
cancel -a -

#
top - process list

lsbom .pkg/Contents/Archive.bom> | more - show pkg contents

# say - speak what follows

ifconfig - network info

# example to thin down a Universal binary
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

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!

#speed up Safari
defaults write com.apple.Safari WebKitInitialTimedLayoutDelay 0.25 - first  hint
defaults write com.apple.Safari WebKitInitialTimedLayoutDelay -float 0.25 - 2nd hint

also, clear out Icons directory in ~Library/Safari

Turn off all the languages you don't need. In the Finder, select the Safari application and do a Get Info (Command-I), click "Languages," and uncheck all the languages you don't need.

# wget to retrieve html for offline viewing
wget -r -A jpg -- would get all jpg files, recursively

# run multiple copies of app
sudo -u larry /Applications/Safari.app/Contents/MacOS/Safari &

#search Google with part of URL
inurl:/something/something
link:www.gladbird.com
intitle:something it title page
site: - restrict to site
filetype:
phonebook:birdsong+CA
index of /somedirectory
inurl:.bash_history

ln -s destinationDir linkName

# awstats
http://localhost/awstats/awstats.pl?config=gladbird

#convert dmg to iso
hdiutil convert imagefile.dmg -format UDTO -o imagefile.iso
mv imagefile.iso.cdr imagefile.iso


#find a wifi router that isn't giving dhcp

1- open the terminal
2- type "sudo tcpdump -n -i en1" (en1 or whatever is your wireless card)
3- type your password
4- wait for a broadcast
5- now you have the broadcast address. So it's simple to retain both network and subnet mask
6- assign to yourself an address on that network
7- ping all host in that network (with hping o nmap -sP)
8- one of the responding host should be the gateway (usually lower or upper ones)

********
if you have trouble logging on with a WEP pwd, try putting a $ in front of the pwd
*********

# stop macbook pro from awaking when lid opens
sudo pmset lidwake 0

also you may...
Deleting power management-related .plist files In some instances, this issue can be resolved by deleting the following files:

/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist
/Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist
~/Library/Preferences/com.apple.systemuiserver.plist

system_profiler - about this mac

# I somehow deleted admin users on this machine except admin from 
Directory - had the double entry of admin/admin1 locally and admin/admin on
the network Directory/Server. admin was already in use on the server.

After much research and reading...

boot to single user mode

change root passwd: passwd - enter twice ; test was my password

dsenableroot -u root -p test -r test
I wanted to be able to sign in as root if the following didn't work...

execute:
fsck -fy
mount -uw /
launchctl load /System/Library/LaunchDaemons/com.apple.DirectoyrServices.plist
launchctl load /System/Library/LaunchDaemons/com.apple.DirectoyrServicesLocal.plist
passwd - entered test twice
dscl . -append /Groups/admin GroupMembership larry

bluehost.com uses port 22 for sftp

# list user/groups
dscacheutil -q group

# unpack tar in different directory
tar xvf -C tmp/a/b/c newarc.tar.gz

# the && doesn't let tar run unless cd is successful
cd tmp/a/b/c && tar xvf ~/archive.tar

# also || , cd to dir OR make it if it doesn't exist
cd tmp/a/b/c || mkdir -p tmp/a/b/c

# combine last two command above
cd tmp/a/b/c || mkdir -p tmp/a/b/c && tar xvf -C tmp/a/b/c ~/archive.tar

# example of quoting and not quoting a variable
~ $ ls tmp/
a b
~ $ VAR="tmp/*"
~ $ echo $VAR
tmp/a tmp/b
~ $ echo "$VAR"
tmp/*
~ $ echo $VARa

~ $ echo "$VARa"

~ $ echo "${VAR}a"
tmp/*a
~ $ echo ${VAR}a
tmp/a
~ $

## good use of escape sequence, line continuation
~ $ cd tmp/a/b/c || \
> mkdir -p tmp/a/b/c && \
> tar xvf -C tmp/a/b/c ~/archive.tar


## xargs common use
~ $ find some-file-criteria some-file-path | \
> xargs some-great-command-that-needs-filename-arguments

## another example of xargs
~/tmp $ ls -1 | xargs
December_Report.pdf README a archive.tar mkdirhier.sh
~/tmp $ ls -1 | xargs file
December_Report.pdf: PDF document, version 1.3
README: ASCII text
a: directory
archive.tar: POSIX tar archive
mkdirhier.sh: Bourne shell script text executable
~/tmp $

## open all safari windows in tabs
defaults write com.apple.Safari TargetedClicksCreateTabs -bool true

## find files not backed up by time machine
sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'" | more

## disable question on new disk install
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool YES

##
supposed to reset keychains:
/System/Library/Frameworks/SecurityFoundation.framework/Versions/A/Resources/kcSync.app/Contents/MacOS/kcSync -reset
Got this from macosx.com, solved someone elses kcSync "old" profile password request

##
Processes that are using an Internet connection:
lsof -P -i -n | cut -f 1 -d " " | uniq

##