首页 服务器系统 Linux

linux查看硬件配置命令大全

1、查看服务器的CPU

查看CPU信息:

cat /proc/cpuinfo

物理cpu个数:

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

每个物理cpu中core的个数(即核数):

cat /proc/cpuinfo | grep "cpu cores" | uniq

服务器的逻辑CPU = 物理个数 * 核数

2、查看服务器的内存情况

[root@localhost ~]# free -h
    total   used    free  shared   buff/cache        available
Mem:   15G     857M    12G   23M      1.5G                 13G

参数解释:

  • total 内存总数
  • used 已经使用的内存数
  • free 空闲的内存数
  • shared 多个进程共享的内存总额
  • buffers Buffer Cachecached Page Cache 磁盘缓存的大小
  • -buffers/cache (已用)的内存数:used - buffers - cached
  • +buffers/cache(可用)的内存数:free + buffers + cached
  • 可用的memory=free memory+buffers+cached

3、服务器磁盘使用情况

查看当前硬盘使用情况:

df –h

查看硬盘性能:

iostat -x 1 10

4、查看环境变量

查看环境变量:

env 

5、网络

查看所有网络接口的属性:

ifconfig 

查看防火墙设置:

iptables -L

查看路由表:

route -n

查看所有监听端口:

netstat -lntp

查看所有已经建立的连接:

netstat -antp

查看网络统计信息:

netstat -s
相关推荐