1. 查找最大文件
sudo find / -type f -exec du -h {} + 2>/dev/null | sort -rh | head -n 20
2.查看系统类型和版本
cat /etc/os-release
3.查看哪个进程在写入文件
lsof | grep nohup.out
4.查看某个进程
ps aux | grep 'go run main.go'
5.统计端口的连接数量
netstan -an |grep :443 |wc -l
6.安装宝塔
wget -O install.sh http://download.bt.cn/install/install_6.0.sh && bash install.sh
7.通过日志统计URL的流量
awk '{url=$7; size=$10; sum[url]+=size} END{for(u in sum) print sum[u], u}' access.log | sort -nr |head -n 50
8.将大文件原地“截断”,仅保留最后 10000 行
tail -n 10000 yourfile.log | sponge yourfile.log
-------------------------------------------------------------------------------------------------
持续更新中
-------------------------------------------------------------------------------------------------