Shell

Shell常用快捷键

常用快捷键

Descriptions ShortCut
删除光标左边所有 ctrl-U
删除光标右边所有 ctrl-K
移动光标到行首 ctrl-A
移动光标到行尾 ctrl-E

常用命令

chmod + x ass.file //设置文件权限
mv ass.file filename //更改文件名

关闭gatekeeper

关闭gatekeeper可以允许Mac安装任何来源的APP

sudo spctl --master-disable

bash 设置socks5代理

~/.bashrc文件中加入如下function:

function setproxy() {
    # export {HTTP,HTTPS,FTP}_PROXY="http://127.0.0.1:3128"
    export ALL_PROXY=socks5://127.0.0.1:1080
}

function unsetproxy() {
    # unset {HTTP,HTTPS,FTP}_PROXY
    unset ALL_PROXY
}

Fish Shell

  • 设置fish为默认shell
chsh -s /usr/local/bin/fish
echo /usr/local/bin/fish | sudo tee -a /etc/shells
  • 安装OMF
curl -L github.com/oh-my-fish/oh-my-fish/raw/master/bin/install | fish
omf help
omf install pure
omf theme pure
  • fish中安装rvm
omf install rvm
rvm install x.x
rvm use x.x

在shell当前session中设置代理

  • ~/.config/fish/functions创建setproxy.fish文件并设置如下function:
function setproxy
  export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;
  echo "====== current socks proxy:"$https_proxy"======"
end
  • ~/.config/fish/functions创建unsetproxy.fish文件并设置如下function:
function unsetproxy
  set -e http_proxy
  set -e https_proxy
  echo '====== current shell session proxy is erased ======'
end
  • 测试更改是否生效
curl -i http://ip.cn

curl

  1. 设置socks5代理
curl -x 127.0.0.1:1086 {url}

nvm-fish

git clone https://github.com/Alex7Kom/nvm-fish.git ~/.nvm-fish
source ~/.nvm-fish/nvm.fish

results matching ""

    No results matching ""