常用命令

Tree

# 安裝
brew install tree
# 使用
tree -d        // 只顯示文件夾
tree -L n        // 顯示項(xiàng)目的層級(jí) n表示層級(jí)數(shù)
tree -I pattern        // 用于過(guò)濾不想要顯示的文件或者文件夾
tree > tree.md        // 將項(xiàng)目結(jié)構(gòu)輸出到 tree.md 這個(gè)文件
# 

清除 dns 緩存

# OS X Mountain Lion or Lion
sudo dscacheutil -flushcache
# Mac OS X v10.6
sudo killall -HUP mDNSResponder

nginx

# 安裝
brew install nginx
# 重啟
nginx -s reload

初始化 git

# 生成 ssh
ssh-keygen -t rsa -C ""
# 別名
ssh-keygen -t rsa -f ~/.ssh/zhongan -C ""
# 設(shè)置姓名/郵箱
git config --global user.name "zhanghao"
git config --global user.email ""
# 關(guān)閉 SSL 驗(yàn)證
git config --global http.sslVerify false

安裝 oh-my-zsh

# <http://www.itdecent.cn/p/ba08713c2b19>
sh -c "$(curl -fsSL <https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh>)"

autojump

# 安裝
brew install autojump

# zshrc 配置
# 編輯 vi ~/.zshrc
plugins=(git autojump)
[[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.sh

# 刷新配置
source ~/.zshrc

# 目錄權(quán)限問(wèn)題
chmod 755 /opt/homebrew/share/zsh

# 刪除 Last Login
touch ~/.hushlogin

安裝 brew

# <https://zhuanlan.zhihu.com/p/59805070>
# <https://zhuanlan.zhihu.com/p/112383265?from_voters_page=true>
git clone git://mirrors.ustc.edu.cn/homebrew-core.git//usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

# 使用國(guó)內(nèi)鏡像
/bin/zsh -c "$(curl -fsSL <https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh>)"

# 解除鎖定
rm -rf /usr/local/var/homebrew/locks
# 或者這樣
sudo chown -R "$USER":admin /usr/local
brew cleanup

環(huán)境變量

# 編輯
vi ~/.bash_profile
# 刷新
source ~/.bash_profile

curl https

# <https://blog.csdn.net/lixuande19871015/article/details/88788699>
# 下載證書(shū)
<https://curl.haxx.se/ca/cacert.pem>
# 設(shè)置環(huán)境變量
vi ~/.bash_profile
export CURL_CA_BUNDLE=/etc/curlssl/cacert.pem
source ~/.bash_profile

VSCode

# 設(shè)置字體
<https://blog.csdn.net/chenghai37/article/details/81417293>

設(shè)置文件權(quán)限

# 找到模塊地址
npm root -g
# 設(shè)置權(quán)限 
sudo chown -R $applename ../node_modules

Github 訪(fǎng)問(wèn)慢

# <https://github.com.ipaddress.com/>
# 刷新 cdn
dscacheutil -flushcache

GitLab 同步 fork 分支

# 添加項(xiàng)目遠(yuǎn)程倉(cāng)庫(kù)到 upstream 
git remote add upstream <倉(cāng)庫(kù)地址> 
# 刪除本地 upstream
git remote rm upstream
# 查看配置信息
git config --list
# 更新到本地的 upstream 
git fetch upstream 
# merge
git merge upstream/master

Git 多賬號(hào)登錄

<https://www.barretlee.com/blog/2016/03/09/config-in-ssh-after-troubling-git-connection/>
# ~/.ssh/config
# personal server  
Host personal
  HostName proxy1.barretlee.com proxy2.barretlee.com
  User barretlee
  IdentityFile ~/.ssh/proxy.barretlee.com.key

# school
HostName 222.20.74.89
  User school
  LocalForward 8999 127.0.0.1:3306
  IdentityFile ~/.ssh/school.key
# and so on.

husky 配置

npm install husky lint-staged commitlint -D && npx husky init
//.husky/pre-commit
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
npx --no-install commitlint --edit $1
# 增加權(quán)限
chmod ug+x .husky/*
chmod ug+x .git/hooks/*
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容