linux常用命令

2024-07-29 18:49:41 浏览数 (1)

1、核心命令 linux 监控网络IO、磁盘、CPU、内存:

CPU:vmstat 、sar –u、top 磁盘IO:iostat –xd、sar –d、top 网络IO:iftop -n、ifstat、dstat –nt、sar -n DEV 2 3 磁盘容量:df –h 内存使用:free –m、top 2、常用命令 (1)内存:条数、每条大小、内存是DDR4还是DDR3、内存频率是2666MT/S还是1600MT/s

条数: dmidecode|grep -A5 ‘Memory Device’|grep Size | grep -v Installed |wc -l

每条大小: dmidecode|grep -A5 ‘Memory Device’|grep Size | grep -v Installed |uniq

内存类型: dmidecode | grep -A16 “Memory Device” | grep ‘Type:’ |grep -v Unknown |uniq

内存频率: dmidecode | grep -A16 “Memory Device” | grep ‘Speed’ |grep -v Unknown |uniq

(2)硬盘:块数,大小

fdisk -l | grep “Disk /dev/sd”

(3)查看什么进程占用端口

netstat -antp | fgrep

(4)查看进程资源

jps -l # 获取进程id jmap -heap 21046 (5)CPU个数

cat /proc/cpuinfo| grep “physical id”| sort| uniq| wc -l

(6)CPU核数

cat /proc/cpuinfo| grep “cpu cores”| uniq

(7)CPU主频

cat /proc/cpuinfo| grep “model name”| uniq

0 人点赞