Linux 常用命令

查看系统

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 查看 Linux 版本
lsb_release -a

# 查看内核版本
uname -r

# 查看内存
free -mh

# 查看物理CPU个数
lscpu
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l

# 查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq

# 查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l

# 查看 cpu 性能模式
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# 高级版 top
htop

ps -eLo pid,psr,command |sed -ne '/^\W\+[0-9]\+\W\+2\W\+/p'

网卡信息

查看网卡生产厂家和型号的基本信息

1
2
3
4
5
6
7
8
9
10
11
12
13
lspci

# 查看网卡生产厂家和型号的详细信息
lspci -vvv

# 针对 Mellonax
show_gids

# 查看网卡 NUMA
cat /sys/class/net/enp5s0f0/device/numa_node

# 查看 bond
cat /proc/net/bonding/bond1

查看网卡驱动版本

1
2
3
4
5
6
modinfo
ethtool -i eth3

# 查看网络接口队列数
cat /proc/interrupts | grep eth0
ethtool -S eth0

Mellanox 网卡

1
2
3
4
5
6
7
8
# 获取驱动信息
mlxfwmanager

# 获取设备信息
ibv_devinfo

# ib和net
ibdev2netdev

网络速率

1
2
3
4
nload <device-name>

mlnx_perf -i ens3f1np1 | grep "tx_bytes_phy\|rx_bytes_phy"
mlnx_perf -i ens3f0np0 | grep "tx_bytes_phy\|rx_bytes_phy"

存储

text
1
2
3
4
5
6
7
8
iostat - 查看磁盘使用率
iostat -xtm 1

iotop - 查看正在使用磁盘的应用

dd - 测试顺序读写的带宽

fio - 体系化测试