使用Mac命令別名,提高工做效率

爲系統添加命令別名能夠提升咱們的工做效率,告別命令繁瑣,庸長的的煩惱。git

Mac的~/.bash_profile文件提供了爲系統添加命令別名的地方。因此咱們要操做的也是這個文件。github

下面是修改~/.bash_profile文件的步驟。objective-c

在mac中設置命令別名的方法以下:xcode

1.編寫或者新建~/.bash_profile文件,並添加經常使用命令別名以下:緩存

#詳細打印
alias ll='ls -Alh'
#代碼片斷目錄
alias snip='cd ~/Library/Developer/Xcode/UserData/CodeSnippets'
#XCode代碼緩存目錄
alias xcodeCC='cd ~/Library/Developer/Xcode/DerivedData'
#顯示隱藏文件
alias showAll='defaults write com.apple.finder AppleShowAllFiles -bool true;KillAll Finder'
#關閉隱藏文件
alias showPart='defaults write com.apple.finder AppleShowAllFiles -bool false;KillAll Finder'
#打印IP地址
alias ip='ifconfig en0'
#將OC源碼編譯成C、C++
alias cc='clang -rewrite-objc'
#將OC源碼編譯成C、C++
alias cc2='clang -x objective-c -rewrite-objc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'
注意:「=」兩邊不要加空格
 
2.:wq保存以後從新打開terminal或者執行命令:source ~/.bash_profile
命令別名GitHub倉庫地址: https://github.com/zhfei/aliases
經常使用命令逐步完善中
相關文章
相關標籤/搜索