Mac for Unix Geeks

Mac for Unix Geeks

Mac for Unix Geeks ## references - dynamic man library <https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/> - CLI guides 10.3 <http://www.apple.com/server/docs/Command_Line.pdf> (10.3) 10.6 <http://manuals.info.apple.com/MANUALS/1000/MA1173/en_US/IntroCommandLine_v10.6.pdf> 10.9 <http://help.apple.com/advancedserveradmin/mac/3.1> Mac for Unix Geeks 4E (Leopard) [2008] <http://shop.oreilly.com/product/9780596520632.do> - Developer Tools (XCode) - gcc, make - Command Line Developer Tools for OS X - autoinstall on first run ## history AT&T UNIX -> A/UX (1991 Quadra 700/900) NeXTStep: (1989) 4.3BSD + Mach microkernel + Objective-C (1991) Tim Berners-Lee uses NeXTCube to create Web 1996 MkLinux for PowerPC 1997 Apple acquires NeXT OPENSTEP -> Darwin on XNU (modified Mach) kernel + I/O Kit 2001 Mac OS X 10.0 ## access Terminal Command-S at startup >console at login box (if showing user/password) ## shortcuts drag folder to Terminal window to insert path option-click to reposition cursor within shell command save shell scripts with .command suffix to make them clickable apps ## integration - where Unix appears Console == tail -f logs firewall via ipfw / pf sharing via File Sharing (smbd), Remote Login (sshd), Internet Sharing (natd), Web (Apache), Screen Sharing (VNC) printing via CUPS - <http://localhost:631> $ cupsctl WebInterface=yes OS X Server - CardDAV, CalDAV, DHCP (bootpd), Wiki/WebDAV, Mail (cyrus/dovecot/postfix), VPN (raccoon/ pppd), DNS (bind) X11 / XQuartz ## paths FreeBSD file structure title-case (Apple-land) vs lowercase (Unix-land) /private (etc, tmp, var) /Applications, Developer, Library, Network, System, Users, Volumes /.DocumentRevisions-V100/ (Versions) /.Spotlight-V100/ (metadata) /.Trashes/, ~/.Trashes/ ## commands * open open [path/to/document] || [path/to/folder] || [app name] # open document in alt editor $ open -a textwrangler test.txt # open URL in default browser open [URL] opendiff file1 file2 - launches FileMerge (part of Developer Tools) * clipboard pbcopy < filename $ command | pbcopy pbpaste pbpaste > filename $ pbpaste | command * Quick Look qlmanage -p [path/to/file] - preview file * text nano vi -> vim emacs * files applesingle / binhex / macbinary dot_clean .DS_Store (Finder settings, e.g. icon location and window size) ls -le (ACL) ls -l@ (extended attributes) [Spotlight] mdfind (search) / mdls (view metadata) / mdutil (manage metadata) / mdimport scp -E The ʻ-Eʼ flag preserves extended attributes, resource forks, and ACL information. textutil $ textutil -info MyFile $ textutil -convert html MyWordFile -output /tmp/webfile.html * PLists == Property Lists, defaults # set user LoginHook sudo defaults write com.apple.loginwindow LoginHook /path/to/script Property LIst Editor (XCode) /usr/libexec/PlistBuddy # Allow user to set DVD region once upon first insertion of disc $ /usr/libexec/PlistBuddy -c "Set :rights:system.device.dvd.setregion.initial:class allow" /etc/authorization plutil ## remote admin * disks asr - Apple System Restore rsync | ditto | dd bless - manage boot / startup volumes createhomedir diskutil (Disk Utility - physical disks) hdiutil (DU - disk images) drutil (DU - disk burners) disktool (deprecated) * network airport $ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s networksetup # check DNS servers on Ethernet interface $ networksetup -getdnsservers ethernet scutil - system config $ scutil -r IP $ scutil --get ComputerName (sharing) | LocalHostName (Bonjour) | HostName $ scutil --dns * software installer / pkgutil / packagemaker softwareupdate * system info sysctl - kernel state $ sysctl -n hw.model $ sysctl -n machdep.cpu.brand_string $ sysctl vm.loadavg system_profiler * system settings nvram -p pmset #Set System Sleep Preferences | 0 = Off | 15 = 15 Min | 20 = 20 Min | etc | $ pmset sleep 0 systemsetup # List startup disks $ systemsetup -liststartupdisks # Show current startup disk $ systemsetup -getstartupdisk # Change startup disk $ systemsetup -setstartupdisk path # Set time zone and time server. $ systemsetup -setusingnetworktime on $ systemsetup -settimezone America/New_York -setnetworktimeserver time.apple.com # Activate WakeOnLAN. $ systemsetup -setwakeonnetworkaccess on # Set computer to start up after power failure $ systemsetup -setwaitforstartupafterpowerfailure seconds (0 | 30 / +30 ) * user/group dscl dsmemberutil - to see what group a user or another group are a member of, or check user/group UUIDs dseditgroup - To edit, create, manipulate, or delete groups # Allow all local users to add/remove printers, as part of the lpadmin group, substitute localadmin for your admin's short username dseditgroup -o edit -u localadmin –t group -a staff _lpadmin dscacheutil - To work with various Directory Service caches, including LDAP and DNS # flush DNS cache 10.4: $lookupd -flushcache 10.5/10.6: dscacheutil -flushcache 10.7/10.8: sudo killall -HUP mDNSResponder dsenableroot - to enable root - - - ## misc automator / amlint / osascript caffeinate (10.8+) - disable sleep osascript scriptfile - run AppleScripts $ osascript -e 'Applescript syntax' screencapture $ screencapture -m screenfile.png ## launchd launchctl /System/Library/LaunchDaemons - Apple system daemons /System/Library/LaunchAgents - Apple agents (all users) /Library/LaunchDaemons - third party system daemons /Library/LaunchAgents - third party agents (all users) ~/Library/LaunchAgents - third party agents (logged-in user) Schedule via StartCalendarInterval / StartInterval keys ## extending - MacOSForge.org - open sourced Apple projects (WebKit, XQuartz) - MacPorts.org | FinkProject.org | Homebrew (Brew.sh) ## tools <http://www.clockwise.ee/gasmask/> - edit Hosts <http://www.hanynet.com/icefloor/> - Icefloor - edit PF Platypus Term2 Visor.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us