OSX – Routing network traffic over specific connections


To route the network traffic over specific Network connections open the Terminal.
To add a route enter the following command: sudo route add "source ip" "destination gateway"
To delete the route enter the following command : sudo route delete "source ip"

OSX – Flush DNS Cache


To clean your DNS Cache you have to open the Terminal and enter the following command:
sudo killall -HUP mDNSResponder

OSX – See recent search in Safari 6


To see the search history in Safari 6 you only have to open Safari and press Command + L.
After that you’ll have to press the SPACE key.
Now you see your search history.

OSX – default commands


Here are a lot of default commands for several cases:
To use them, open Terminal (in /Applications/Utilities), then paste one of the commands into Terminal and press Return.
# Disable menu bar transparency
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false
# Show remaining battery time; hide percentage
defaults write com.apple.menuextra.battery ShowPercent -string "NO"
defaults write com.apple.menuextra.battery ShowTime -string "YES"

# Always show scrollbars
defaults write NSGlobalDomain AppleShowScrollBars -string "Always"

# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
# Disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
# Display ASCII control characters using caret notation in standard text views
# Try e.g. `cd /tmp; unidecode “x{0000}” > cc.txt; open -e cc.txt`
defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true
# Disable opening and closing window animations
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
# Increase window resize speed for Cocoa applications
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
# Disable Resume system-wide
defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false
# Disable the “reopen windows when logging back in” option
# This works, although the checkbox will still appear to be checked,
# and the command needs to be entered again for every restart.
defaults write com.apple.loginwindow TALLogoutSavesState -bool false
defaults write com.apple.loginwindow LoginwindowLaunchesRelaunchApps -bool false

# Fix for the ancient UTF-8 bug in QuickLook (http://mths.be/bbo)
# Commented out, as this is known to cause problems when saving files in Adobe Illustrator CS5 🙁
#echo “0x08000100:0” > ~/.CFUserTextEncoding
# Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Enable subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 2
# Disable press-and-hold for keys in favor of key repeat
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0
# Disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Enable tap to click (Trackpad) for this user and for the login screen
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1

# Map bottom right Trackpad corner to right-click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1
defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true

# Require password immediately after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0

# Allow quitting Finder via ? + Q; doing so will also hide desktop icons
defaults write com.apple.finder QuitMenuItem -bool true
# Disable window animations and Get Info animations in Finder
defaults write com.apple.finder DisableAllAnimations -bool true
# Show all filename extensions in Finder
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Show status bar in Finder
defaults write com.apple.finder ShowStatusBar -bool true
# Allow text selection in Quick Look
defaults write com.apple.finder QLEnableTextSelection -bool true
# Disable disk image verification
defaults write com.apple.frameworks.diskimages skip-verify -bool true
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true

# Automatically open a new Finder window when a volume is mounted
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true

# Display full POSIX path as Finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
# Avoid creating .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Show item info below desktop icons
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
# Enable snap-to-grid for desktop icons
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
# Disable the warning before emptying the Trash
defaults write com.apple.finder WarnOnEmptyTrash -bool false
# Empty Trash securely by default
defaults write com.apple.finder EmptyTrashSecurely -bool true
# Enable AirDrop over Ethernet and on unsupported Macs running Lion
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
# Show the ~/Library folder
chflags nohidden ~/Library
# Hot corners
# Top left screen corner ? Mission Control
defaults write com.apple.dock wvous-tl-corner -int 2
defaults write com.apple.dock wvous-tl-modifier -int 0

# Top right screen corner ? Desktop
defaults write com.apple.dock wvous-tr-corner -int 4
defaults write com.apple.dock wvous-tr-modifier -int 0

# Bottom left screen corner ? Start screen saver
defaults write com.apple.dock wvous-bl-corner -int 5
defaults write com.apple.dock wvous-bl-modifier -int 0

# Enable highlight hover effect for the grid view of a stack (Dock)
defaults write com.apple.dock mouse-over-hilte-stack -bool true
# Enable spring loading for all Dock items
defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true
# Show indicator lights for open applications in the Dock
defaults write com.apple.dock show-process-indicators -bool true
# Don’t animate opening applications from the Dock
defaults write com.apple.dock launchanim -bool false
# Remove the auto-hiding Dock delay
defaults write com.apple.Dock autohide-delay -float 0
# Enable the 2D Dock
defaults write com.apple.dock no-glass -bool true
# Automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true
# Make Dock icons of hidden applications translucent
defaults write com.apple.dock showhidden -bool true
# Enable iTunes track notifications in the Dock
defaults write com.apple.dock itunes-notifications -bool true
# Add a spacer to the left side of the Dock (where the applications are)
defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'
# Add a spacer to the right side of the Dock (where the Trash is)
defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}'

# Disable shadow in screenshots
defaults write com.apple.screencapture disable-shadow -bool true
# Disable Safari’s thumbnail cache for History and Top Sites
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
# Enable Safari’s debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
# Make Safari’s search banners default to Contains instead of Starts With
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
# Remove useless icons from Safari’s bookmarks bar
defaults write com.apple.Safari ProxiesInBookmarksBar "()"
# Add a context menu item for showing the Web Inspector in web views
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true

# Enable the debug menu in Address Book
defaults write com.apple.addressbook ABShowDebugMenu -bool true
# Enable the debug menu in iCal
defaults write com.apple.iCal IncludeDebugMenu -bool true
# Only use UTF-8 in Terminal.app
defaults write com.apple.terminal StringEncodings -array 4
# Disable the Ping sidebar in iTunes
defaults write com.apple.iTunes disablePingSidebar -bool true
# Disable all the other Ping stuff in iTunes
defaults write com.apple.iTunes disablePing -bool true
# Make ? + F focus the search input in iTunes
defaults write com.apple.iTunes NSUserKeyEquivalents -dict-add "Target Search Field" "@F"
# Disable send and reply animations in Mail.app
defaults write com.apple.Mail DisableReplyAnimations -bool true
defaults write com.apple.Mail DisableSendAnimations -bool true

# Copy email addresses as `foo@example.com` instead of `Foo Bar ` in Mail.app
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
# Enable Dashboard dev mode (allows keeping widgets on the desktop)
defaults write com.apple.dashboard devmode -bool true
# Reset Launchpad
[ -e ~/Library/Application Support/Dock/*.db ] && rm ~/Library/Application Support/Dock/*.db
# Disable local Time Machine backups
hash tmutil &> /dev/null && sudo tmutil disablelocal
# Remove Dropbox’s green checkmark icons in Finder
file=/Applications/Dropbox.app/Contents/Resources/check.icns
[ -e "$file" ] && mv -f "$file" "$file.bak"
unset file

# Kill affected applications
for app in Safari Finder Dock Mail SystemUIServer; do killall "$app" > /dev/null 2>&1; done
echo "Done
. Note that some of these changes require a logout/restart to take effect.”

OSX – Commands for Web Site Management


1. host
If you need to find out the IP of a domain, type
host apple.de
apple.de has address 17.172.224.31
apple.de has address 17.149.160.31

2. whois
You can use whois to quickly find if a domain name exists and its registrar information.
whois apple.com
[Querying whois.verisign-grs.com]
[whois.verisign-grs.com]
Whois Server Version 2.0
Domain Name: CLOUDSY.COM
Registrar: ENOM, INC.
Whois Server: whois.enom.com
Referral URL: http://www.enom.com
Name Server: NS1.CLOUDSY.COM
Name Server: NS2.CLOUDSY.COM
Status: ok
Updated Date: 28-mar-2009
Creation Date: 25-mar-2009
Expiration Date: 25-mar-2010

3. passwd
If your web host gave you SSH access, you can use it to do simple things in your account like quickly changing your password.
passwd yourusername
Changing password for user yourusername.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

4. cd – Navigate to your Desktop
cd /users/yourusername/Desktop
Navigate in a web server
cd /home/yourusername/public_html/site
5. mkdir – Make a new directory
mkdir Photos
6. mv – Move a file into a folder
mv IMG_8151.JPG Photos

OSX – Terminal Commands

OSX – Terminal Commands

alias     Create an alias
alloc     List used and free memory
awk       Find and Replace text within file(s)
basename  Convert a full pathname to just a folder path
bash      Bourne-Again SHell (Linux)
bless     Set volume bootability and startup disk options.
break     Exit from a loop
cal       Display a calendar
case      Conditionally perform a command
cat       Display the contents of a file
cd        Change Directory
chflags   Change a file or folder's flags.
chgrp     Change group ownership
chmod     Change access permissions
chown     Change file owner and group
chroot    Run a command with a different root directory
cksum     Print CRC checksum and byte counts
clear     Clear terminal screen
cmp       Compare two files
comm      Compare two sorted files line by line
complete  Edit a command completion [word/pattern/list]
continue  Resume the next iteration of a loop
cp        Copy one or more files to another location
cron      Daemon to execute scheduled commands
crontab   Schedule a command to run at a later date/time
cut       Divide a file into several parts
date      Display or change the date & time
dc        Desk Calculator
dd        Data Dump - Convert and copy a file
defaults  The Mac OS X user defaults system.
df        Display free disk space
diff      Display the differences between two files
diff3     Show differences among three files
dig       DNS lookup
dirname   Convert a full pathname to just a path
dirs      Display list of remembered directories
diskutil  Disk utilities - Format, Verify, Repair
ditto     Copy files and folders
dot_clean Remove dot-underscore files
dscacheutil Query or flush the Directory Service/DNS cache
dscl      Directory Service command line utility
du        Estimate file space usage
echo      Display message on screen
ed        A line-oriented text editor (edlin)
enable    Stop or start printers and classes.
env       Set environment and run a utility
eval      Evaluate several commands/arguments
exec      Execute a command
exit      Exit the shell
expect    Programmed dialogue with interactive programs
          Also see AppleScript
expand    Convert tabs to spaces
expr      Evaluate expressions
false     Do nothing, unsuccessfully
fdisk     Partition table manipulator for Darwin UFS/HFS/DOS
find      Search for files that meet a desired criteria
fmt       Reformat paragraph text
fold      Wrap text to fit a specified width
for       Expand words, and execute commands
foreach   Loop, expand words, and execute commands
fsck      Filesystem consistency check and repair
fsaclctl  Filesystem enable/disable ACL support
fs_usage  Filesystem usage (process/pathname)
ftp       Internet file transfer program
GetFileInfo Get attributes of HFS+ files
getopt    Parse positional parameters
goto      Jump to label and continue execution
grep      Search file(s) for lines that match a given pattern
groups    Print group names a user is in
gzip      Compress or decompress files
head      Display the first lines of a file
hdiutil   Manipulate iso disk images
history   Command History
hostname  Print or set system name
id        Print user and group names/id's
if        Conditionally perform a command
info      Help info
install   Copy files and set attributes
jobs      List active jobs
join      Join lines on a common field
kextfind  List kernel extensions
kill      Stop a process from running
l         List files in long format (ls -l)
ll        List files in long format, showing invisible files (ls -la)
less      Display output one screen at a time
ln        Make links between files (hard links, symbolic links)
locate    Find files
logname   Print current login name
login     log into the computer
logout    Exit a login shell (bye)
lpr       Print files
lprm      Remove jobs from the print queue
lpstat    Printer status information
ls        List information about file(s)
lsbom     List a bill of materials file
lsof      List open files
man       Help manual
mkdir     Create new folder(s)
mkfifo    Make FIFOs (named pipes)
more      Display output one screen at a time
mount     Mount a file system
mv        Move or rename files or directories
net       Manage network resources
networksetup Network and System Preferences
nice      Set the priority of a command
nohup     Run a command immune to hangups
onintr    Control the action of a shell interrupt
open      Open a file/folder/URL/Application
osascript Execute AppleScript
passwd    Modify a user password
paste     Merge lines of files
pbcopy    Copy data to the clipboard
pbpaste   Paste data from the Clipboard
pico      Simple text editor
ping      Test a network connection
pkgutil   List installed packages
pmset     Power Management settings
popd      Restore the previous value of the current directory
pr        Convert text files for printing
printenv  Print environment variables
printf    Format and print data
ps        Process status
pushd     Save and then change the current directory
pwd       Print Working Directory
quota     Display disk usage and limits
rcp       Copy files between machines.
repeat    Execute a command multiple times
rm        Remove files
rmdir     Remove folder(s)
rpm       Remote Package Manager
rsync     Remote file copy - Sync file tree (also RsyncX)
say       Convert text to audible speech
sched     Schedule a command to run at a later time.
screen    Multiplex terminal, run remote shells via ssh
screencapture Capture screen image to file or disk
sdiff     Merge two files interactively
security  Administer Keychains, keys, certificates and the Security framework
sed       Stream Editor
set       Set a shell variable = value
setenv    Set an environment variable = value
setfile   Set attributes of HFS+ files
shift     Shift positional parameters
shutdown  Shutdown or restart OS X
sleep     Delay for a specified time
softwareupdate System software update tool
sort      Sort text files
split     Split a file into fixed-size pieces
stop      Stop a job or process
su        Substitute user identity
sudo      Execute a command as another user
sum       Print a checksum for a file
switch    Conditionally perform a command
systemsetup Computer and display system settings
tail      Output the last part of files
tar       Tape ARchiver
tee       Redirect output to multiple files
test      Condition evaluation
textutil  Manipulate text files in various formats
time      Measure Program Resource Use
touch     Change file timestamps
traceroute Trace Route to Host
tr        Translate, squeeze, and/or delete characters
true      Do nothing, successfully
tty       Print filename of terminal on stdin
type      Describe a command
umask     Users file creation mask
umount    a device
unalias   Remove an alias
uname     Print system information
unexpand  Convert spaces to tabs
uniq      Uniquify files
units     Convert units from one scale to another
unset     Remove variable or function names
unsetenv  Remove environment variable
users     Print login names of users currently logged in
uuencode  Encode a binary file
uudecode  Decode a file created by uuencode
vi        Text Editor
wc        Print byte, word, and line counts
where     Report all known instances of a command
which     Locate a program file in the user's path
while     Execute commands
who       Print all usernames currently logged on
whoami    Print the current user id and name (`id -un')
xargs     Execute utility - passing arguments
yes       Print a string until interrupted

http://developer.apple.com/documentation/Darwin/Reference/ManPages/index.html

 

OSX – Force unmount Disk terminal command


To force unmount a OSX Disk with a terminal command please open Terminal.APP from your Applications folder.
Enter the following command:
sudo diskutil unmount force /volumes/volumename
After this command you have to enter your admin password and the Disk is unmounted.

OSX – Terminal



Terminal ist für Mac Os das, was die Eingabeaufforderung für Windows ist, nur sehr viel komplexer. Mit dem Terminal lässt sich sogut wie das ganze Mac OS steuern, wenn man weiß wie, hier findet ihr einige nützliche Kommandos.
 

 
nützliche Terminal Commands
Alle Terminal Commands werden als Einzeiler(!) in der Terminal Konsole eingegeben.

Kommando Aktion
ping 127.0.0.1 pingt ein Netzwerkgerätum unter Mac OS Ping zu stoppen CTRL+C drücken
top Zeigt eine Liste von laufenden Prozessen an, ähnlich der Aktivitätsanzeige.
kill PID 456 Beendet den Prozess mit der angegebenen PID (456).Um die richtige PID zu finden nutze einfach dieses Kommando.
defaults write com.apple.Finder AppleShowAllFiles TRUE; killAll Finder Zeigt versteckte Dateien im Finder an.
defaults write com.apple.ScreenCapture type JPG; killAll SystemUIServer Stellt das Format für Screenshots auf JPG, weitere mögliche Formate sind: PNG, PDF, TIFF, JPEG, BMP, GIF, PSD.
defaults write com.apple.Screencapture disable-shadow -bool TRUE; killAll SystemUIServer Deaktiviert den Fensterschatten bei Screenshots.
defaults write com.apple.Screencapture location /Users/benutzername; killAll SystemUIServer Ändert den Speicherordner für Screenshots auf Euren Benutzerordner.
defaults write com.apple.screencapture name; killAll SystemUIServer Ändert den Dateinamen für Screenshots auf einen von euch definierten Benutzerordner. Dies betrifft nur den Anfang “Bildschirmfoto 2010-00-00 um 00.00.00.png”
defaults write com.apple.Finder QuitMenuItem -bool YES; killAll Finder Fügt im Findermenü den Punkt “Finder Beenden” hinzu.Achtung: ohne Finder kein Schreibtisch!
say “Mac Voice Engine Lässt euren Mac mit der eingebauten Sprachengine den Text “Mac Voice Engine” ausgeben.
defaults write com.apple.Dock ShowHidden -bool YES; killAll Dock Macht ausgeblendete Icons im Dock transparent sichtbar.
defaults write com.apple.Dashboard devmode YES; killall Dock Hiermit lassen sich Dashboard Widgets auch auf dem Schreibtsich (Desktop) nutzen.Klicke im Dashboard auf das gewünschte Widget halte die Maustaste gedrückt und drücke dann F12.
qlmanage -r Startet Quick Look neu & läd ggf. neue Plugins.
defaults write -g com.apple.mouse.scaling 18 setzt die Mauszeigergeschwindigkeit