Linux 一些常用脚本
Linux 一些常用脚本

Linux 一些常用脚本

评测

bash <(curl -Lso- https://git.io/superbench)
bash <(curl -Lso- https://git.io/Jlkmw)
curl -Lso- bench.sh | bash
curl -sL yabs.sh | bash
bash <(wget -qO- --no-check-certificate https://gitlab.com/spiritysdx/za/-/raw/main/ecs.sh
或大杂烩curl -L https://gitlab.com/spiritysdx/za/-/raw/main/ecs.sh -o ecs.sh && chmod +x ecs.sh && bash ecs.sh
或Nodebench bash <(curl -sL https://raw.githubusercontent.com/LloydAsp/NodeBench/main/NodeBench.sh)

硬盘测试

dd bs=64k count=4k if=/dev/zero of=test oflag=dsync

BT开心

curl https://io.bt.sy/install/update_panel.sh|bash

安装 docker和compose

bash <(curl -sL get.docker.com)
systemctl start docker
systemctl enable docker
curl -SL "https://github.com/docker/compose/releases/latest/download/docker-compose-linux-$(uname -m)" -o /bin/docker-compose
chmod +x /bin/docker-compose

禁用IPv6

echo -e "net.ipv6.conf.all.disable_ipv6=1\nnet.ipv6.conf.default.disable_ipv6=1\nnet.ipv6.conf.lo.disable_ipv6=1" >> /etc/sysctl.conf
sysctl -p

重启网络

sudo /etc/init.d/networking restart

回程

wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh

NF检测

x86: wget -O nf https://github.com/sjlleo/netflix-verify/releases/download/2.61/nf_2.61_linux_amd64 && chmod +x nf && clear && ./nf
ARM: wget -O nf https://github.com/sjlleo/netflix-verify/releases/download/2.61/nf_2.61_linux_arm64 && chmod +x nf && clear && ./nf

流媒体检测

bash <(curl -sSL "https://github.com/CoiaPrant/MediaUnlock_Test/raw/main/check.sh")
bash <(curl -L -s check.unlock.media) -M 4

开启BBR

echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
sysctl -n net.ipv4.tcp_congestion_control

设置root密码

sudo -i
echo root:<要设置的密码> |sudo chpasswd root
sudo sed -i 's/^#\?PermitRootLogin.<em>/PermitRootLogin yes/g' /etc/ssh/sshd_config; sudo sed -i 's/^#\?PasswordAuthentication.</em>/PasswordAuthentication yes/g' /etc/ssh/sshd_config;
sudo service sshd restart

多种一键脚本

bash <(curl -sL hollywoo.de/sh/all.sh)

开启端口

sudo iptables -I INPUT -s 0.0.0.0/0 -p tcp --dport 8888 -j ACCEPT
sudo iptables -I INPUT -s 0.0.0.0/0 -p tcp --dport 10808 -j ACCEPT
sudo iptables -I INPUT -s 0.0.0.0/0 -p tcp --dport 80 -j ACCEPT
sudo iptables -I INPUT -s 0.0.0.0/0 -p tcp --dport 443 -j ACCEPT
sudo iptables-save
sudo apt-get update
sudo apt-get install iptables-persistent -y
sudo netfilter-persistent save
sudo netfilter-persistent reload

快速共享文件

比如想共享/home/share目录,那么就依次执行

cd /home/share
python -m SimpleHTTPServer

程序会直接开始运行,要退出的话直接按Ctrl+C即可。

如果是 Python3 环境下,此功能已经合并到了http.server模块中,命令变为:

python -m http.server

默认情况下会自动监听 8000 端口,使用 IP:8000 即可访问。如果要指定端口,则后面跟随需要的端口即可,比如监听 8888 端口:

python -m SimpleHTTPServer 8888

批量重命名

rename -n 's/<old>/<new>/g' *.<ext>

以上代码会在实际替换前预览更改,需要实际操作去掉-n

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注