//升级
apt update && apt upgrade -y && apt dist-upgrade -y && apt autoremove -y
//
修改SSH端口
vim /etc/ssh/sshd_config
//UFW ALLOW
ufw enable
ufw allow 1000/tcp
//fail2ban
sudo apt install fail2ban
//systemed
systemctl daemon-reexec
systemctl daemon-reload
caddy validate --config /etc/caddy/Caddyfile
systemctl restart caddy && systemctl status caddy
xray -test -config /usr/local/etc/xray/config.json
systemctl restart xray && systemctl status xray
touch ~/.hushlogin
$env:HTTP_PROXY="http://127.0.0.1:10808"
$env:HTTPS_PROXY="http://127.0.0.1:10808"
相关快捷键
Ctrl + C 中断当前运行的命令
Ctrl + D 发送 EOF(结束输入),退出 shell 或程序
Ctrl + Z 将当前任务挂起,转入后台
Ctrl + L 清屏(等同于 clear 命令)
Ctrl + A 光标移动到行首
Ctrl + E 光标移动到行尾
Ctrl + U 删除光标前的整行内容
Ctrl + K 删除光标后的整行内容
Ctrl + W 删除光标前的一个单词
Ctrl + T 交换光标前两个字符
Ctrl + R 搜索历史命令(输入关键字自动匹配)
Ctrl + Y 粘贴最近剪切的内容
Ctrl + S 暂停终端输出(锁屏)
Ctrl + Q 恢复终端输出(解锁)
Ctrl + _ 撤销上一步(部分 shell 支持)
//查看服务状态和正在保护的 jail
fail2ban-client status
//查看具体 jail 的详情
fail2ban-client status sshd
//重载配置但不重启服务
fail2ban-client reload
//控制服务启动和停止
fail2ban-client stop / start
//启用并启动服务
systemctl enable --now fail2ban //即刻启用并自启
//检查状态
systemctl status fail2ban
//查看运行状态
systemctl restart fail2ban
//terminal keep alive设置
//ClientAliveInterval 60
//ClientAliveCountMax 3
vim /etc/ssh/sshd_config
# Debian/Ubuntu
service ssh restart
//快速巡检
echo "=== 登录失败 ==="
grep "Failed password" /var/log/auth.log | tail
echo "=== 当前连接 ==="
ss -antp | grep ESTAB
echo "=== 开放端口 ==="
ss -tulnp
echo "=== 高CPU进程 ==="
ps aux --sort=-%cpu | head
echo "=== 最近文件 ==="
find / -mtime -1 -type f 2>/dev/null | head