ps -eo pid,comm,rss,%mem --sort=-rss | head -n 10 | awk 'NR==1{printf "%-6s %-16s %-10s %-5s\n", $1, $2, $3, $4} NR>1{printf "%-6s %-16s %7.2f MB %-5s\n", $1, $2, $3/1024, $4}'
列出占用内存最多的前 10 个进程
ps -eo pid,comm,%cpu --sort=-%cpu | head -n 10
列出占用CPU最多的前 10 个进程
du -h --max-depth=1 / | sort -h -r
显示根目录下每个子目录的磁盘使用情况,并按从大到小的顺序排序。
cat /etc/passwd | cut -d: -f1
从/etc/passwd
文件中提取并显示所有用户的用户名
find / -path '/proc' -prune -o -path '/sys' -prune -o -path '/run' -prune -o -type f -size +500M -exec ls -lh {} \; 2>/dev/null | sort -k5 -hr
找出大于 500MB 的文件
dd if=/dev/zero of=test.tmp bs=1G count=1 oflag=direct
测试硬盘写入速度,
-
if=/dev/zero
:以全零数据作为输入 -
of=test.tmp
:输出到临时文件 -
bs=1G count=1
:一次写 1GB -
oflag=direct
:绕过缓存,更真实
netstat -an | grep ESTABLISHED | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head
查看当前连接最多的目标IP(排查异常访问)
lscpu | grep -E '^Model name|^CPU\(s\)|^Thread|^Socket|^Core'
查看 CPU 信息简化版
last -a | head
SSH最近登录历史
find /WebFile/ -type f | wc -l
统计/WebFile/
目录下的文件数量
- THE END -
最后修改:2025年6月21日
非特殊说明,本博所有文章均为博主原创。
如若转载,请注明出处:https://ospf.me/ml
共有 0 条评论