wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh && chmod +x box.sh && clear && ./box.sh
git clone https://github.com/kejilion/sh
wget -q https://github.com/Aniverse/A/raw/i/a && bash a
GNU/Linux 更换系统软件源
bash <(curl -sSL https://linuxmirrors.cn/main.sh)
DD脚本
1.甲骨文DD脚本
DD成Debian 10
bash <(wget --no-check-certificate -qO- 'https://raw.githubusercontent.com/MoeClub/Note/master/InstallNET.sh') -d 10 -v 64 -p "自定义root密码" -port "自定义ssh端口"
DD成Ubuntu 20.04
bash <(wget --no-check-certificate -qO- 'https://raw.githubusercontent.com/MoeClub/Note/master/InstallNET.sh') -u 20.04 -v 64 -p "自定义root密码" -port "自定义ssh端口"
2、MoeClub脚本
重点推荐:
时间:22/11/2021 15:21 萌咖更新脚本:
1.新增对 Oracle AMD,Oracle ARM全面支持. 可支持从 Ubuntu, Oracle Linux 等系统网络重装.
2.更新 dd 镜像的基础系统版本.
3.移除对外部 wget 的依赖.
4.新增 -port 参数, 可更改默认SSH端口.
5.更新 内置的网络参数计算 逻辑.
6.更新 grub 配置文件定位逻辑, 可支持任意引导grub的系统.
以下系统已通过测试(其他自测):
Debian: 9, 10, 11;
Ubuntu: 18.04, 20.04;
CentOS: 6.10;
以下平台已通过测试(其他自测):
Oracle、Do、Azure
bash <(wget --no-check-certificate -qO- 'https://raw.githubusercontent.com/MoeClub/Note/master/InstallNET.sh') -d 10 -v 64 -p "自定义root密码" -port "自定义ssh端口"
-d 10 -v 64
-d 9 -v 64
-u 20.04 -v 64
-u 18.04 -v 64
开机改密码脚本:
开机改密:
#!/bin/bashecho root:Vicer |sudo chpasswd rootsudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config;sudo reboot
3.另一位大佬的脚本
wget --no-check-certificate -O AutoReinstall.sh https://git.io/AutoReinstall.sh && bash AutoReinstall.sh
- CentOS默认密码Pwd@CentOS 其它系统Pwd@Linux
- OpenVZ / LXC 架构系统不适用
bash <(wget --no-check-certificate -qO- 'https://file.geekn.net/CNODnjau/InstallNET.sh') -d 11 -v 64 -a -firmware
-firmware 额外的驱动支持
-d 后面是系统版本号
-v 后面写64位 32位
-a (不清楚这个干啥的但是每个脚本都带)
–mirror 后面是镜像源地址
-p 后面写自定义密码
镜像站地址官方给出的地址列表:https://www.debian.org/mirror/list一些国内的ftp.cn.debian.orgmirror.bjtu.edu.cnmirror.lzu.edu.cn mirror.nju.edu.cn mirrors.163.com mirrors.bfsu.edu.cn mirrors.hit.edu.cn mirrors.huaweicloud.com mirror.sjtu.edu.cn mirrors.tuna.tsinghua.edu.cn mirrors.ustc.edu.cn 使用方法:(大致都是一样的)清华源--mirror 'https://mirrors.ustc.edu.cn/debian/'腾讯源--mirror 'https://mirrors.aliyun.com/debian/'阿里源--mirror 'https://mirrors.aliyun.com/debian/'华为源--mirror 'https://mirrors.huaweicloud.com/debian/'
系统检测与监控
服务器时间同步
CentOS 同步时间
yum -y install ntpdate
timedatectl set-timezone Asia/Shanghai
ntpdate ntp1.aliyun.com
Linux随机重命名文件夹下文件脚本
#!/bin/bash
for file in *.*; do
# 获取文件的基本名(不包含扩展名)
base=$(basename "$file" .*)
# 获取文件的扩展名
ext=$(basename "$file" | sed 's/^.*\.//')
# 生成一个包含10个随机字符的字符串
RAN=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 10)
# 重命名文件,保留扩展名
mv "$file" "${RAN}.${ext}"
done
导出目录下所有文件名
#!/bin/bash
# 导出指定目录下的所有文件名到 TXT 文件
# 支持:自定义目录、是否递归子目录、是否带完整路径、过滤文件后缀
# 日志/输出文件命名
OUTPUT_FILE="filenames_export_$(date +'%Y%m%d_%H%M%S').txt"
> $OUTPUT_FILE # 清空输出文件
# 打印提示函数(纯文字)
print_tip() {
echo "[$(date +'%Y-%m-%d %H:%M:%S')] $1"
}
# ======================== 输入配置 ========================
print_tip "开始执行文件名导出脚本"
# 1. 获取目标目录
read -p "请输入要导出文件名的目录路径(绝对路径/相对路径,如 /home/data 或 ./test):" TARGET_DIR
# 验证目录是否存在
if [ ! -d "$TARGET_DIR" ]; then
print_tip "错误:目录 $TARGET_DIR 不存在,请检查路径后重试"
exit 1
fi
# 2. 选择是否递归子目录
read -p "是否导出子目录中的文件名?(y/n,默认 n):" IS_RECURSIVE
if [ -z "$IS_RECURSIVE" ] || [ "$IS_RECURSIVE" != "y" ]; then
IS_RECURSIVE="n"
else
IS_RECURSIVE="y"
fi
# 3. 选择是否带完整路径
read -p "导出的文件名是否带完整路径?(y/n,默认 n):" WITH_PATH
if [ -z "$WITH_PATH" ] || [ "$WITH_PATH" != "y" ]; then
WITH_PATH="n"
else
WITH_PATH="y"
fi
# 4. 可选:过滤指定后缀的文件(如 txt,mp4,留空则导出所有)
read -p "是否过滤文件后缀?(输入后缀名,多个用逗号分隔,如 txt,mp4;留空则导出所有):" FILTER_EXT
# 格式化后缀(去掉空格、统一小写)
FILTER_EXT=$(echo "$FILTER_EXT" | tr -d ' ' | tr 'A-Z' 'a-z')
# ======================== 核心导出逻辑 ========================
print_tip "开始导出目录 $TARGET_DIR 下的文件名..."
# 构建 find 命令参数
FIND_CMD="find $TARGET_DIR"
# 是否递归子目录
if [ "$IS_RECURSIVE" = "n" ]; then
FIND_CMD="$FIND_CMD -maxdepth 1"
fi
# 只匹配文件(排除目录本身)
FIND_CMD="$FIND_CMD -type f"
# 过滤文件后缀(如有)
if [ -n "$FILTER_EXT" ]; then
# 拆分后缀并构建 find 过滤条件
IFS=',' read -ra EXT_LIST <<< "$FILTER_EXT"
FILTER_STR=""
for ext in "${EXT_LIST[@]}"; do
if [ -n "$ext" ]; then
if [ -z "$FILTER_STR" ]; then
FILTER_STR="-name *.$ext"
else
FILTER_STR="$FILTER_STR -o -name *.$ext"
fi
fi
done
FIND_CMD="$FIND_CMD \( $FILTER_STR \)"
fi
# 执行导出
if [ "$WITH_PATH" = "y" ]; then
# 导出完整路径
eval $FIND_CMD >> $OUTPUT_FILE
else
# 仅导出文件名(去掉路径)
eval $FIND_CMD | xargs -I {} basename {} >> $OUTPUT_FILE
fi
# ======================== 结果统计 ========================
FILE_COUNT=$(wc -l < $OUTPUT_FILE)
print_tip "导出完成!共导出 $FILE_COUNT 个文件名"
print_tip "导出文件路径:$(pwd)/$OUTPUT_FILE"
print_tip "脚本执行完毕"
exit 0
导出目录下所有文件的绝对路径到TXT文本
#!/bin/bash
# 导出目录下所有文件的绝对路径到TXT(优化版)
# ===================== 颜色定义 =====================
RED='\033[31m'
GREEN='\033[32m'
YELLOW='\033[33m'
BLUE='\033[36m'
NC='\033[0m'
# ===================== 函数定义 =====================
# 显示进度条
show_progress() {
local current=$1
local total=$2
local percent=$((current * 100 / total))
local bar_length=40
local filled_length=$((percent * bar_length / 100))
local bar=$(printf "%${filled_length}s" | tr ' ' '#')
local empty=$(printf "%$((bar_length - filled_length))s" | tr ' ' '-')
echo -ne "\r${YELLOW}进度:${NC}[$bar$empty] $percent% ($current/$total)"
}
# 验证目录有效性
get_valid_dir() {
local dir_path
while true; do
read -p "$1" dir_path
dir_path=$(eval echo "$dir_path" | xargs) # 处理 ~ 符号和空格
if [ -d "$dir_path" ] && [ -r "$dir_path" ]; then
realpath "$dir_path"
break
else
echo -e "${RED}错误:目录不存在或无读取权限!${NC}"
fi
done
}
# ===================== 主流程 =====================
clear
echo -e "${GREEN}===== Linux文件路径导出工具 =====${NC}"
# 1. 获取输入
TARGET_DIR=$(get_valid_dir "请输入要扫描的目录路径: ")
read -p "请输入结果保存的TXT路径 (例如 ./output.txt): " OUTPUT_FILE
OUTPUT_FILE=$(eval echo "$OUTPUT_FILE")
# 2. 统计文件总数 (排除隐藏文件和隐藏目录下的文件)
echo -e "\n${BLUE}正在计算文件总数...${NC}"
# 使用 -not -path '*/.*' 排除隐藏文件和隐藏目录
TOTAL_FILES=$(find "$TARGET_DIR" -type f -not -path '*/.*' | wc -l)
if [ "$TOTAL_FILES" -eq 0 ]; then
echo -e "${YELLOW}未找到任何非隐藏文件。${NC}"
exit 0
fi
# 3. 执行导出
> "$OUTPUT_FILE"
CURRENT=0
echo -e "${GREEN}开始导出至: ${BLUE}$OUTPUT_FILE${NC}"
# 使用 while 循环配合 find 的 -print0 确保处理含空格的文件名
while IFS= read -r -d '' file; do
realpath "$file" >> "$OUTPUT_FILE"
((CURRENT++))
# 每处理 10 个文件更新一次进度条,平衡视觉效果与性能
if (( CURRENT % 10 == 0 || CURRENT == TOTAL_FILES )); then
show_progress $CURRENT $TOTAL_FILES
fi
done < <(find "$TARGET_DIR" -type f -not -path '*/.*' -print0)
echo -e "\n\n${GREEN}成功!已导出 $CURRENT 条路径。${NC}"
NodeQuality
bash <(curl -sL https://run.NodeQuality.com)
1.机器测试
来源:https://github.com/masonr/yet-another-bench-script
wget https://github.com/masonr/yet-another-bench-script/blob/master/yabs.sh
GeekBench
GB6 跑分脚本,附带宽测试:
curl -sL yabs.sh | bash
GB6 剔除带宽测试,因为都是国外节点测试,国内跑没多大意义:
curl -sL yabs.sh | bash -s -- -i
GB5 跑分脚本,附带宽测试:
curl -sL yabs.sh | bash -5
GB5 剔除带宽测试:
curl -sL yabs.sh | bash -s -- -i -5
单线程测试
bash <(curl -Lso- https://bench.im/hyperspeed)
最全测速脚本
curl -fsL https://ilemonra.in/LemonBenchIntl | bash -s fast
速度测试
显示延迟、抖动
bash <(wget -qO- https://bench.im/hyperspeed)
直接显示回程线路
curl https://raw.githubusercontent.com/zhucaidan/mtr_trace/main/mtr_trace.sh|bash
wget -q route.f2k.pub -O route && bash route
# 第一个
wget https://raw.githubusercontent.com/nanqinlang-script/testrace/master/testrace.sh
bash testrace.sh
# 第二个
wget -qO- git.io/besttrace | bash
四网测速
wget -O jcnf.sh https://raw.githubusercontent.com/Netflixxp/jcnfbesttrace/main/jcnf.sh
bash jcnf.sh
三网测速
bash <(curl -Lso- https://git.io/superspeed_uxh)
带快速四网测试版本:
bash <(curl -Lso- https://dl.233.mba/d/sh/speedtest.sh)
bash <(curl -Lso- https://git.io/J1SEh)
测试25端口是否开放
telnet smtp.aol.com 25
测试IPv4优先还是IPv6优先
curl ip.p3terx.com
流媒体测试
全媒体测试
bash <(curl -L -s https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/check.sh)
奈飞测试
wget -O nf https://github.com/sjlleo/netflix-verify/releases/download/2.5/nf_2.5_linux_amd64 && chmod +x nf && clear && ./nf
# 第一个
bash <(curl -L -s https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/check.sh)
# 第二个
bash <(curl -sSL "https://github.com/CoiaPrant/MediaUnlock_Test/raw/main/check.sh")
BBR
CentOS 7 BBR
wget -N --no-check-certificate "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh
一键开启BBR
注意:需要Linux Kernel 内核升级到 4.9 及以上版本可以实现 BBR 加速
uname -srm
输出结果:
Linux 3.10.0-957.12.2.el7.x86_64 x86_64
3 - 内核版本.
10 - 主修订版本.
0-957 - 次要修订版本.
12 - 补丁版本.
一般来说,Ubuntu18.04以上就可以(默认的内核4.15)
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
sysctl net.ipv4.tcp_available_congestion_control
lsmod | grep bbr
网站搭建
wget https://raw.githubusercontent.com/kejilion/sh/main/kejilion.sh
sudo bash kejilion.sh
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#=================================================================#
# System Required: CentOS7 X86_64 #
# Description: FFmpeg Stream Media Server #
#=================================================================#
# 颜色选择
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
font="\033[0m"
ffmpeg_install(){
# 安装FFMPEG
read -p "你的机器内是否已经安装过FFmpeg4.x?安装FFmpeg才能正常推流,是否现在安装FFmpeg?(yes/no):" Choose
if [ $Choose = "yes" ];then
yum -y install wget
wget --no-check-certificate https://www.johnvansickle.com/ffmpeg/old-releases/ffmpeg-4.0.3-64bit-static.tar.xz
tar -xJf ffmpeg-4.0.3-64bit-static.tar.xz
cd ffmpeg-4.0.3-64bit-static
mv ffmpeg /usr/bin && mv ffprobe /usr/bin && mv qt-faststart /usr/bin && mv ffmpeg-10bit /usr/bin
fi
if [ $Choose = "no" ]
then
echo -e "${yellow} 你选择不安装FFmpeg,请确定你的机器内已经自行安装过FFmpeg,否则程序无法正常工作! ${font}"
sleep 2
fi
}
stream_start(){
# 定义推流地址和推流码
read -p "输入你的推流地址和推流码(rtmp协议):" rtmp
# 判断用户输入的地址是否合法
if [[ $rtmp =~ "rtmp://" ]];then
echo -e "${green} 推流地址输入正确,程序将进行下一步操作. ${font}"
sleep 2
else
echo -e "${red} 你输入的地址不合法,请重新运行程序并输入! ${font}"
exit 1
fi
# 定义视频存放目录
read -p "输入你的视频存放目录 (格式仅支持mp4,并且要绝对路径,例如/opt/video):" folder
# 判断是否需要添加水印
read -p "是否需要为视频添加水印?水印位置默认在右上方,需要较好CPU支持(yes/no):" watermark
if [ $watermark = "yes" ];then
read -p "输入你的水印图片存放绝对路径,例如/opt/image/watermark.jpg (格式支持jpg/png/bmp):" image
echo -e "${yellow} 添加水印完成,程序将开始推流. ${font}"
# 循环
while true
do
cd $folder
for video in $(ls *.mp4)
do
ffmpeg -re -i "$video" -i "$image" -filter_complex overlay=W-w-5:5 -c:v libx264 -c:a aac -b:a 192k -strict -2 -f flv ${rtmp}
done
done
fi
if [ $watermark = "no" ]
then
echo -e "${yellow} 你选择不添加水印,程序将开始推流. ${font}"
# 循环
while true
do
cd $folder
for video in $(ls *.mp4)
do
ffmpeg -re -i "$video" -c:v copy -c:a aac -b:a 192k -strict -2 -f flv ${rtmp}
done
done
fi
}
# 停止推流
stream_stop(){
screen -S stream -X quit
killall ffmpeg
}
# 开始菜单设置
echo -e "${yellow} CentOS7 X86_64 FFmpeg无人值守循环推流 For LALA.IM ${font}"
echo -e "${red} 请确定此脚本目前是在screen窗口内运行的! ${font}"
echo -e "${green} 1.安装FFmpeg (机器要安装FFmpeg才能正常推流) ${font}"
echo -e "${green} 2.开始无人值守循环推流 ${font}"
echo -e "${green} 3.停止推流 ${font}"
start_menu(){
read -p "请输入数字(1-3),选择你要进行的操作:" num
case "$num" in
1)
ffmpeg_install
;;
2)
stream_start
;;
3)
stream_stop
;;
*)
echo -e "${red} 请输入正确的数字 (1-3) ${font}"
;;
esac
}
# 运行开始菜单
start_menu






