Ubuntu 脚本日记记录

0.Ubuntu切换root权限

方法一
sudo -i

方法二
步骤1: 给root用户设置密码: 命令:sudo passwd root 输入密码,并确认密码。
步骤2: 重新输入命令:su root 然后输入密码: 发现可以切换到root权限了。
步骤3: 使用su xyx命令,切换到普通用户。

1.重命名 主机名

sudo hostnamectl set-hostname 新主机名

2.关闭防火墙

①开放所有端口

sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -F

②清理并重启

sudo apt-get purge netfilter-persistent
reboot

3.更新操作系统环境

apt update -y && apt install -y curl && apt install -y socat && apt install wget -y

4.开启BBR2加速

wget -N –no-check-certificate “https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh” && chmod +x tcp.sh && ./tcp.sh

5.查看磁盘大小、使用、挂载信息

df -h

6.邮寄25端口检测

telnet smtp.aol.com 25

7.实例基础信息检测(系统信息 硬盘测速 国际互联 CPU跑分)

apt update -y && apt install -y curl wget sudo

curl -sL yabs.sh | bash -s — -i -5

8.流媒体解锁

bash <(curl -L -s check.unlock.media)

9.三网去程线路(供参考 有时候不准)

curl https://raw.githubusercontent.com/zhucaidan/mtr_trace/main/mtr_trace.sh|bash

注: 准一点 可以去这个网站 测试网址:(TraceRoute https://tools.ipip.net/traceroute.php

10.去程检测工具-准确(本机IP到VPS)

路由追踪工具Nexttrace(Besttrace的替代项目)
https://trace.ac/README_zh_CN.html

Linux 一键安装脚本

bash <(curl -Ls https://raw.githubusercontent.com/sjlleo/nexttrace/main/nt_install.sh)

GHPROXY 镜像(国内使用)

bash <(curl -Ls https://ghproxy.com/https://raw.githubusercontent.com/sjlleo/nexttrace/main/nt_install.sh)

11.三网回程延迟测试脚本

wget -qO- git.io/besttrace | bash

12.实例到国内区域测速(Fast.com 南京 合肥 上海)

wget -qO- bench.sh | bash