linux怎么查看机子硬件的版本,linux 查看系统版本及硬件信息

----------------CPU----------------

查看CPU型号等详细信息

1)通用方法

cat /proc/cpuinfo

processor       : 0

vendor_id       : GenuineIntel

cpu family      : 6

model           : 46

model name      : Intel(R) Xeon(R) CPU           E7520  @ 1.87GHz

stepping        : 6

cpu MHz         : 1064.000

cache size      : 18432 KB

physical id     : 0

……

# 总核数 = 物理CPU个数 X 每颗物理CPU的核数

# 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数

① 查看物理CPU的个数

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

2

② 查看逻辑CPU的个数

#cat /proc/cpuinfo |grep "processor"|wc -l

24

③ 查看CPU是几核

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

6

2)CentOS方法

lscpu

Architecture:          i686

CPU op-mode(s):        32-bit, 64-bit

CPU(s):                16

Thread(s) per core:    2

Core(s) per socket:    4

CPU socket(s):         2

Vendor ID:             GenuineIntel

CPU family:            6

Model:                 46

Stepping:              6

CPU MHz:               1064.000

Virtualization:        VT-x

L1d cache:             32K

L1i cache:             32K

L2 cache:              256K

L3 cache:              18432K

----------------内存----------------

查看内存使用情况

free -m

total       used       free     shared    buffers     cached

Mem:         32158       2383      29775          0        466        862

-/+ buffers/cache:       1054      31104

Swap:            0          0          0

查看内存详信息

cat /proc/meminfo

MemTotal:       14409828 kB

MemFree:         7795036 kB

Buffers:          361792 kB

Cached:          5762836 kB

SwapCached:            0 kB

Active:          2755200 kB

……

查看内存插槽总数、已使用的插槽数及每插槽内存条容量

dmidecode|grep  -P  -A5  "Memory\s+Device"|grep Size|grep -v Range

Size: 4096 MB

Size: 4096 MB

Size: No Module Installed

Size: No Module Installed ……

查看支持最大内存容量

dmidecode|grep -P  'Maximum\s+Capacity'

Maximum Capacity: 256 GB

----------------磁盘----------------

查看磁盘使用情况 2秒钟刷新一次

iostat -d -x /dev/sda1 2

Linux 2.6.18-164.el5 (meter1)   07/22/2015

Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util

sda1              0.00     0.22  0.00  0.15     0.07     2.91    19.83     0.00    3.96   0.84   0.01

Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util

sda1              0.00     2.00  0.00  6.50     0.00    68.00    10.46     0.02    3.62   0.38   0.25

----------------网卡----------------

dmesg |grep -i eth

lspci |grep -i eth

ifconfig -a

ip link

----------------查看HBA卡----------------

cat /sys/class/fc_host/host*/port_name

所有关于HBA的信息都可以在cat /sys/class/fc_host/host*/ 目录下通过cat查看。

如速率 cat /sys/class/fc_host/host*/speed

如状态 cat /sys/class/fc_host/host*/port_state

如类型 cat /sys/class/fc_host/host*/port_type 等等

----------------操作系统版本---------------- 查看当前操作系统内核信息

uname -a

Linux meter1 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

查看当前操作系统发行版信息

1)通用方法

cat /etc/issue |grep Linux

Red Hat Enterprise Linux Server release 5.4 (Tikanga)

2) 可用方法

cat /etc/redhat-release

CentOS Linux release 6.0 (Final)

3)只支持redhat等部分linux

lsb_release  -a

LSB Version:    :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch

Distributor ID: RedHatEnterpriseServer

Description:    Red Hat Enterprise Linux Server release 5.4 (Tikanga)

Release:        5.4

Codename:       Tikanga

4)查看当前操作系统内核GCC版本

cat /proc/version

Linux version 2.6.18-164.el5 (mockbuild@x86-003.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Tue Aug 18 15:51:48 EDT 2009

----------------综合信息---------------- 系统硬件运行状态信息(即开机后的硬件运行状态信息)

dmesg

dmidecode --help

Usage: dmidecode [OPTIONS]

Options are:

-d, --dev-mem FILE     Read memory from device FILE (default: /dev/mem)

-h, --help             Display this help text and exit

-q, --quiet            Less verbose output

-s, --string KEYWORD   Only display the value of the given DMI string

-t, --type TYPE        Only display the entries of given type

-u, --dump             Do not decode the entries

--dump-bin FILE    Dump the DMI data to a binary file

--from-dump FILE   Read the DMI data from a binary file

-V, --version          Display the version and exit

查看PCI信息,即主板所有硬件槽信息

lspci

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值