Darwin
Darwin 是开源的。但ios 版不是。
uname -a //查看当前的版本
Darwin Yonglins-Mini.lan 15.3.0 Darwin Kernel Version 15.3.0: Thu Dec 10 18:40:58 PST 2015; root:xnu-3248.30.4~1/RELEASE_X86_64 x86_64
Mac系统的环境变量,加载顺序为:
/etc/profile /etc/paths ~/.bash_profile ~/.bash_login ~/.profile ~/.bashrc
常用工具安装
Xcode Commandline Tools:
xcode-select —install
installed path: /Library/Developer/CommandLineTools
brew
安装:访问 http://brew.sh
常用命令:
brew list
brew update
brew install gdb/lua
brew install aircrack-ng
Finder:
Cmd+ Shift + U //Open utility directory
Terminal Command
cd - // Back to where you were
tail -f filename //Follow a file
mkdir -p /dir1/dir2/dir3
Cmd+ K //Clear
Cmd+ +/- //Resize
Ctrl+ a/e //move to the beginning or end of the line
echo $SHELL //show default shell
echo $0 //show current shell
wifi
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport
airport -I
airport -s
sudo airport sniff channel
aircrack-ng *.cap | grep 1_ handshake
aircrack-ng -w password.txt -e SSID capfilename.cap
unrar
解压文件:
unrar x filename.rar -ppassword //-photnrg -pwww.pt80.com
Filemonitor:
sudo fse
解压文件
tar -xzvf vlc-ios-2.7.8.tar.gz
tar -xzvf *.tgz
gunzip xxx.tar.xz
tar xvd xxx.tar
sudo systemsetup -getremotelogin
sudo systemsetup -setremtelogin on/off
otool nm
dyldinfo
Leopard(10.5) is the first OS X which got UNIX certification
client port error while execute mdfind.
Metadata.framework [Error]: couldn't get the client port
execute
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
to enable Spotlight and sudo mdutil -i off /
to disable indexing.
Find
Find *.c files which contain PANIC
find ./ -name "*.c" | xargs grep PANIC
C++
gcc -framework ApplicationServices -framework SystemConfiguration QueryConf.c -o queryconf
gcc -lstdc++
gcc
gcc -std=c89
gcc -ansi
Chapter 2
The first user mode process is launchd.
Darwin is a UNIX implementation. 10.5 is the first OS X which get certified.
To enable ssh on OS X, open the ssh.plist under /System/Library/LaunchDaemons. Then change the value for disable to false. Or remove the key completely.
应用程序的默认设置保存在属性列表中。 ~/Library/Preferences 或 /Library/Preferences
命令: defaults
LaunchServices 框架负责使用关联的程序打开文件。 和 launchd 无关。LaunchServices 的数据库可以用 lsregister 程序导出。
reset the database. lsregister -kill -r -domain local -domain system -domain user
Framework bundle 内建版本化机制 框架可以包含多个版本的代码
Cocoa 框架包含了其他3个框架:Appkit, CoreData 和 Foundation.
框架是特殊形式的库
otool可以对二进制文件进行反汇编(-tV)
otool -L libSystem.B.dylib // Check the dependency of a library
otool -arch i386 -tV /usr/lib/libSystem.B.dylib | more
otool -arch x86_64 -tV /usr/lib/libSystem.B.dylib | more
dyld // Mach-O 加载器