Mac OS X for Unix Geeks Hit The Ground Running Overview 1. System - - PowerPoint PPT Presentation

mac os x for unix geeks
SMART_READER_LITE
LIVE PREVIEW

Mac OS X for Unix Geeks Hit The Ground Running Overview 1. System - - PowerPoint PPT Presentation

Mac OS X for Unix Geeks Hit The Ground Running Overview 1. System Architecture 2. System Administration 3. GUI Tricks 4. Command line tricks 5. Docs & Resources Architecture - 1 - Directory Layout / /Applications and


slide-1
SLIDE 1

Mac OS X for Unix Geeks

Hit The Ground Running

slide-2
SLIDE 2

Overview

  • 1. System Architecture
  • 2. System Administration
  • 3. GUI Tricks
  • 4. Command line tricks
  • 5. Docs & Resources
slide-3
SLIDE 3

Architecture

  • 1 -
slide-4
SLIDE 4
slide-5
SLIDE 5

/ /Applications and /Applications/Utilities /Library /System and /System/Library /Users, /Users/tlim, /Users/Shared, etc.

Directory Layout

slide-6
SLIDE 6

Applications are Directories

$ cd /Applications $ ls -lad iCal* drwxrwxr-x ... 102 Sep 29 14:57 iCal.app $ cd iCal.app $ ls Contents

slide-7
SLIDE 7

$ ls Contents/ Info.plist MacOS PkgInfo Resources version.plist $ file Contents/MacOS/iCal MacOS/iCal: Mach-O universal binary with 2 architectures MacOS/iCal (for architecture i386): Mach-O executable i386 MacOS/iCal (for architecture ppc): Mach-O executable ppc

slide-8
SLIDE 8

App docs are too

$ ls -lad H* drwxr-xr-x 54 tal tal 1836 Dec 3 12:38 HTGR-MacOSX.key $ cd HTGR-MacOSX.key $ ls Contents Hard_Cover_bullet.tiff Hard_Cover_photo-h.tiff Hard_Cover_photo-v.tiff ... index.apxl.gz ...

slide-9
SLIDE 9

Resource Forks

Still exist! Why? To piss me off, that’s why.

slide-10
SLIDE 10

Copying all that metadata

“ditto” “ditto -rsrc” -- Copies “resource forks”

  • -nocache (Doesn’t thrash disk cache)

rsync -E Copies “extended” file attributes SuperDuper -- www.shirt-pocket.com ONLY utility that really copies all meta data: ACLs, timestamps, ownership, “resources”

slide-11
SLIDE 11

SysAdmin

  • 2 -
slide-12
SLIDE 12

Startup Scripts

Apple’s startup items: /System/Library/StartupItems/ Apps and Homegrown items: /Library/StartupItems/ .../StartupItems/Foo/Foo start .../StartupItems/Foo/Foo stop

slide-13
SLIDE 13

Dynamic DNS

ssh tommac.local The “.local” domain is maintained by a peer-to- peer DNS system called “Bonjour” (was Rendezvous) Free download for Windows

slide-14
SLIDE 14

Examples

ssh hostname.local rsync -avP ~/Music/iTunes/. hostname.local:/Users/Shared/Music/ iTunes/. Bonjour Browser www.tildesoft.com/Programs.html

slide-15
SLIDE 15

Mounting Disks

CMD-K -- Mount from a file server:

nfs://servername.com/path/ smb://servername/sharename smb://workgroup;username@netbiosname/share smb://[[[domain;]user[:passd@]]server[/share[/path[/file]]]]

You can create bookmarks/shortcuts to these.

slide-16
SLIDE 16

Command Line Tricks

  • 3 -
slide-17
SLIDE 17

The Terminal app

Like xterm: Not an X11 app Cut and Paste works really well Day-1 Activities: Add it to your app bar Set reasonable prefs: Terminal -> Window Settings (not Preferences) -- Shell -- Close The Window

slide-18
SLIDE 18

Terminal Tricks

Demo: Drag icon into Terminal

slide-19
SLIDE 19

The “open” command

like clicking on a file or directory

  • pen file.ext

Opens with the default app

  • pen dirname

Opens that directory in the Finder alias here="open ."

  • pen -a /Application/suchandsuch

file.ext

  • pen -f
slide-20
SLIDE 20

“open” is magic

cat file.txt | open -f -a / Applications/Microsoft\ Office\ 2004/Microsoft\ Word

slide-21
SLIDE 21

Unix Software

fink -- fink.sourceforge.net Installer for all the usual GNU and F/OSS packages you may be missing. I avoid this. I try to “go native”

slide-22
SLIDE 22

wget

wget? use "curl -O"

slide-23
SLIDE 23

Screw up nvram from the command line

nvram [-p] [-f filename] [-d name] name[=value] ...

  • p print all firmware variables
  • f set firmware variables from a text file
  • d delete the named variable

name=value set named variable name print variable

slide-24
SLIDE 24

Watch the pretty boot messages

$ nvram boot-args boot-args $ sudo nvram boot-args="-v"

slide-25
SLIDE 25

Mess with Airport

/System/Library/PrivateFrameworks/ Apple80211.framework/Versions/A/ Resources/airport -h

slide-26
SLIDE 26

PB access from command

pbpaste >output.txt pbcopy <input.txt

slide-27
SLIDE 27

PB Examples (1)

cat foo | sort | pbcopy (now paste it somewhere) pbpaste pbpaste | more

slide-28
SLIDE 28

Double Header PB

pbpaste | sort | pbcopy pbpaste | sed -e 's/foo/bar/g' | pbcopy

slide-29
SLIDE 29

Spotlight

mdimport (force reindex, etc) mfind Rails mdfind -onlyin ~/Desktop Rails mdfind "kMDItemContentType == 'com.microsoft.word.doc'" mdfind "kind:pdf date:this week" http://0xfe.blogspot.com/2006/03/using- spotlight-from-os-x-commandline.html

slide-30
SLIDE 30

GUI Tricks

  • 4 -
slide-31
SLIDE 31

Everything is clickable

Document windows have icon in them Drag to move the file to a directory OPTION-CLICK to view PATH iChat image Drag a photo there, it just works. Error messages and IP addresses (often) be selected and copied.

slide-32
SLIDE 32

The File Browser

Access Unix directories by typing “/” Drag file into File Browser to change dir.

slide-33
SLIDE 33

Safari Debug Mode

defaults write com.apple.safari IncludeDebugMenu 1 Adds the "Debug" menu to Safari. If you select "Debug > User Agent", you can have Safari masquerade as Internet Explorer to fool web sites that refuse to serve other browsers.

slide-34
SLIDE 34

Scroll Bars

defaults write "Apple Global Domain" AppleScrollBarVariant DoubleBoth puts double-scroll arrows on both sides of the scroll bar

slide-35
SLIDE 35

Show hidden files

defaults write com.apple.finder AppleShowAllFiles True Finder shows hidden files

slide-36
SLIDE 36

Screen Capture Format

defaults write com.apple.screencapture type pdf Change file format for screen captures using command-shift-3 or command-shift-4. Valid formats: pdf, png, jpg, gif (others?).

slide-37
SLIDE 37

Docs/Resources

  • 5 -
slide-38
SLIDE 38

Summary

Good web sites: www.MacOSXHints.com developers.apple.com File bugs: radar.apple.com man pages:

  • pen, mdfind, mdls, ditto, rsync