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
apt update -y && apt install -y curl wget sudo

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.实例带宽测速

国内测速

测试VPS/服务器到中国电信、移动、联通和教育网的速度以及到亚洲的速度(支持IPv4、Ipv6、单线程、多线程)

bash <(curl -Lso- https://bench.im/hyperspeed)

②全球测速

默认全球

curl -sL nws.sh | bash

区域测速
region_name = na, sa, eu, asia, africa, middle-east, india, china, iran

curl -sL nws.sh | bash -s -- -r region_name

示例(仅测亚洲)

curl -sL nws.sh | bash -s -- -r asia

注:一次测速约耗时10-15分钟,消耗流量几十G至上百G不等

示例1:北美测速

curl -sL nws.sh | bash -s -- -r na

示例2:全球测速

curl -sL nws.sh | bash

示例3:亚洲测速

curl -sL nws.sh | bash -s -- -r asia

Ipef测速

curl -sL yabs.sh | bash -s -- -fdg