Linux
~/.zshrc
Section titled “~/.zshrc”# zshexport ZSH="$HOME/.oh-my-zsh"ZSH_THEME="ys"plugins=(git zsh-autosuggestions zsh-syntax-highlighting)source "$ZSH/oh-my-zsh.sh"export EDITOR="vim"
# proxy="127.0.0.1:7897"# export HTTP_PROXY="http://$proxy"# export HTTPS_PROXY="http://$proxy"# export ALL_PROXY="socks5://$proxy"export PATH="$HOME/.local/bin:$PATH"
# C, C++export CC="clang" # "clang-cl"export CXX="clang++" # "clang-cl"export CMAKE_GENERATOR="Ninja"
# Goexport CGO_ENABLED=0export GOPATH="$HOME/go"export GOBIN="$GOPATH/bin"export PATH="$GOBIN:$PATH"# export GO111MODULE=on # Go1.16+ 默认开启 GO111MODULEexport GOROOT="/usr/local/go"export PATH="$GOROOT/bin:$PATH"
# JavaScript nvmexport NVM_DIR="$HOME/.nvm"[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"# JavaScript pnpmexport PNPM_HOME="$HOME/.local/share/pnpm"case ":$PATH:" in *":$PNPM_HOME:"*) ;; *) export PATH="$PNPM_HOME:$PATH" ;;esac
# Python miniconda3export PATH="$HOME/miniconda3/bin:$PATH"__conda_setup="$('conda' 'shell.zsh' 'hook' 2> /dev/null)"if [ $? -eq 0 ]; then eval "$__conda_setup"else if [ -f "$HOME/miniconda3/etc/profile.d/conda.sh" ]; then . "$HOME/miniconda3/etc/profile.d/conda.sh" else export PATH="$HOME/miniconda3/bin:$PATH" fifiunset __conda_setup# Python uv. "$HOME/.local/bin/env"ubuntu
Section titled “ubuntu”wsl --list [--online]wsl --install -d Ubuntuwsl --set-default Ubuntuwsl --shutdown# wsl --unregister Ubuntu
# --- Ubuntu ---sudo apt update && sudo apt full-upgrade -y
sudo apt install \apt-transport-https \build-essential \ca-certificates clang clang-format clang-tools clangd cmake curl \firewalld \gdb git \iperf3 \lld lldb llvm \net-tools ninja-build \pkg-config \tree \vim \wget \zip zsh \--fix-missing -y
sudo apt autoclean && sudo apt autoremove
# --- Mac ---xcode-select --install
brew update && brew upgradebrew install wget cmake ninja pkg-config lld clang-format iperf3 treebrew cleanup && brew autoremove
# zshgit clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions && \git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting# clientcat ~/.ssh/id_rsa.pub | ssh who@?.?.?.? -p 22 "cat >> ~/.ssh/authorized_keys" && ssh who@?.?.?.? -p 22
# vim ~/.ssh/configHost <alias> HostName ?.?.?.? User whorsync [-avz] -e 'ssh -p <remote-port>' <local-path> who@?.?.?.?:<remote-path>rsync [-avz] -e 'ssh -p <remote-port>' who@?.?.?.?:<remote-path> <local-path>
# examplersync ./example.log \ # local path-e 'ssh -p 22' who@?.?.?.?:~/example.log # remote path
rsync -e 'ssh -p 22' who@?.?.?.?:~/example.log \ # remote path./example.log # local pathscp [-r] -P <remote-port> <local-path> who@?.?.?.?:<remote-path>scp [-r] -P <remote-port> who@?.?.?.?:<remote-path> <local-path>
# examplescp -P 22 ./example.log \ # local pathwho@?.?.?.?:~/example.log # remote path
scp -P 22 who@?.?.?.?:~/example.log \ # remote path./example.log # local pathscreen
Section titled “screen”screen -S <name> # 创建虚拟终端screen -r <name> # 返回虚拟终端screen -R <name> # 创建/返回虚拟终端ctrl+a, d # 分离虚拟终端screen -ls # 列出所有虚拟终端tar -cf dst.tar src # .tartar -xf src.tar # .tar
tar -czf dst.tar.gz src # .tar.gztar -xzf src.tar.gz # .tar.gz
tar -cJf dst.tar.xz src # .tar.xztar -xJf src.tar.xz # .tar.xz
tar -cjf dst.tar.bz2 src # .tar.bz2tar -xjf src.tar.bz2 # .tar.bz2
zip -r dst.zip src # .zipunzip dst.zip -d dst # .zipscript
Section titled “script”touch ./example.log && script -a ./example.log| && ||
Section titled “| && ||”left | right: 将 left 的输出作为 right 的输入left && right: 只有 left 执行成功, 才执行 rightleft || right: 只有 left 执行失败, 才执行 right
# -a All# -s Size# -n Numeric-sort# -r Reversels -as | sort -nr# -c count# -i interval# -s packet size# -t ttlping www.bytedance.comping -c 5 www.bytedance.comping -i 3 -s 1024 -t 255 www.bytedance.com# 发送 GET 请求curl https://ys.mihoyo.com/main/character/inazuma\?char\=0# 发送 POST 请求curl -X POST -d 'char=0' https://ys.mihoyo.com/main/character/inazuma# 传输文件mkdir ys.mihoyo.com && \curl https://ys.mihoyo.com/main/character/inazuma\?char\=0 -o ./ys.mihoyo.com/index.htmliperf3
Section titled “iperf3”# client 发送iperf3 -c ?.?.?.? \ # client -i 1 \ # interval -l 8K \ # length -p 3000 \ # port -t 30 # time (s)
# server 监听iperf3 -s \ # server -p 3000 # port硬链接, 软链接
Section titled “硬链接, 软链接”硬链接不能链接目录
ln [-s] /path/to/src /path/to/dst