Skip to content

Instantly share code, notes, and snippets.

@sdycgtgz
Last active November 7, 2021 03:32
Show Gist options
  • Select an option

  • Save sdycgtgz/80b5501b8ef02f5243cdc4eafac79212 to your computer and use it in GitHub Desktop.

Select an option

Save sdycgtgz/80b5501b8ef02f5243cdc4eafac79212 to your computer and use it in GitHub Desktop.
snippets
#全文件夹内文本替换
sed -i "s/桃果/茶叶/g" `grep "桃果" -rl /data/wwwroot/game.tlmy33.cn`
#跳过堡垒机访问服务器
你能在堡垒机访问服务器,就可以在服务器上后台跑一个 ssh
准备一个跳板机修改下 /etc/ssh/sshd_config,加入 => GatewayPorts yes
然后用在服务器上运行 ssh -f -NR "*:[Port]:localhost:22" [User]@[IP]
P.S: Port => 跳板机对外端口
这样访问设置的跳板机 Port,就相当于访问了堡垒机后的服务器
#历史命令排行
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment