在 CentOS 系统中,查看资源(CPU、内存、磁盘、网络等)常用命令如下,按使用场景整理:
top(最常用)top
q 退出1 查看每个 CPU 核心htop(更友好,需安装)yum install -y htop
htop
mpstatmpstat
查看每个 CPU 使用率
freefree -h
-h:人类可读格式(GB / MB)示例输出:
total used free shared buff/cache available
Mem: 7.8G 1.2G 2.1G 100M 4.5G 6.2G
vmstatvmstat 1
查看内存、CPU、IO 综合情况
dfdf -h
查看磁盘空间使用情况
dudu -sh /*
查看各目录占用空间
iostatyum install -y sysstat
iostat -x 1
查看磁盘 IO 性能
ipip a
查看网卡和 IP
ssss -tulnp
查看端口监听情况(替代 netstat)
iftop(实时流量)yum install -y epel-release
yum install -y iftop
iftop
sarsar -u 1 3
sar -r 1 3
sar -d 1 3
查看 CPU / 内存 / 磁盘历史或实时数据
uptimeuptime
查看系统负载(1 / 5 / 15 分钟)
ps aux --sort=-%mem | head
ps aux --sort=-%cpu | head
查看内存 / CPU 占用最高的进程
uname -a
cat /etc/centos-release
lscpu
lsblk
top + df -h + free -hiostat + vmstat + sarss + iftop如果你有具体场景(如:服务器卡顿 / 磁盘满了 / CPU 飙高),可以告诉我,我可以帮你一步步排查。