个人常用脚本及指令备份
LI SIR Lv4
本文距离上次更新已过去 0 天,部分内容可能已经过时,请注意甄别。

一些常用的 Shell 脚本。


docker 搭建 socks5

1
2
3
4
# 指定密码(建议)
docker run -d --name socks5 -p 10808:1080 -e PROXY_USER=用户名 -e PROXY_PASSWORD=密码 --restart=always serjs/go-socks5-proxy
# 不指定密码
docker run -d --name socks5 -p 10808:1080 --restart=always serjs/go-socks5-proxy
1
2
3
10808:1080 #把 docker 的 1080 端口映射到 VPS 的 10808 端口
PROXY_USER #用户连接的用户名,不指定默认为无认证
PROXY_PASSWORD #用户连接的密码,不指定默认为无密码

自定义测速脚本

用于对国外 vps 配置以及网络测试

1
bash <(curl -Lso- https://git.io/superbench)

一键 DD 网络重装脚本

1
2
3
4
5
6
7
wget --no-check-certificate -O AutoReinstall.sh https://git.io/AutoReinstall.sh && bash AutoReinstall.sh

CentOS:Pwd@CentOS

其他 Linux 系统:Pwd@Linux

系统DD包下载:https://dd.1234234.xyz/

Debian/Ubuntu 开启 BBR

1
2
3
4
5
6
7
8
9
10
11
12
# 修改系统变量
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf

# 保存生效
sysctl -p

# 查看内核是否已开启BBR
lsmod | grep bbr

# 显示如下,即成功
tcp_bbr 20480 2

bbr/bbrplus/锐速内核安装脚本

1
2
3
4
5
6
7
8
9
# 卸载内核
wget -N --no-check-certificate "https://github.000060000.xyz/tcp.sh" && chmod +x tcp.sh && ./tcp.sh
# 或
wget -O tcp.sh "https://git.io/coolspeeda" && chmod +x tcp.sh && ./tcp.sh

# 不卸载内核
wget -N --no-check-certificate "https://github.000060000.xyz/tcpx.sh" && chmod +x tcpx.sh && ./tcpx.sh
# 或
wget -O tcpx.sh "https://git.io/JYxKU" && chmod +x tcpx.sh && ./tcpx.sh

服务器状态监控

1
2
3
4
5
6
7
# 海外
curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh
./nezha.sh

# 大陆
curl -L https://cdn.jsdelivr.net/gh/naiba/nezha@master/script/install.sh -o nezha.sh && chmod +x nezha.sh
CN=true ./nezha.sh

宝塔

1
2
3
4
5
6
7
8
挂载数据盘
https://www.bt.cn/bbs/thread-3187-1-1.html

安装面板
https://www.bt.cn/bbs/thread-19376-1-1.html

卸载面板
https://www.bt.cn/bbs/thread-9043-1-1.html

宝塔秒级监控

1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
step=1
for (( i = 0; i < 60; i=(i+step) )); do
curl -sS --connect-timeout 10 -m 60 '网址'
echo "----------------------------------------------------------------------------"
endDate=`date +"%Y-%m-%d %H:%M:%S"`
echo "[$endDate] OK"
echo "----------------------------------------------------------------------------"
sleep $step
done
exit 0

Screen

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 新建 i 窗口
screen -S i

# 查看所有窗口
screen -ls

# 接入 i 窗口
screen -r i

# 关闭 i 窗口
screen -X -S i quit

# 结束已死进程
screen -wipe

Git

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 配置用户名邮箱
git config --global user.name "wkwbk"
git config --global user.email "[email protected]"

# 克隆远程仓库
git clone https://github.com/wkwbk/wkwbk.github.io.git

# 添加当前目录文件
git add .

# 提交说明
git commit -m 'lisir.me'

# 更新到仓库
git push origin main

待更新、、、

 评论
评论插件加载失败
正在加载评论插件
总字数 116.8k 访客数 访问量