Windows下面查看硬件配置信息,通常我们会去下载相关软件,软件会给我们提供非常直观的方式。虽然在Linux下面也有这类的软件,但大家通常不这么做,习惯于使用内置的命令查看。原因大家都知道,因为作为服务器角色的Linux系统通常不会安装GUI桌面的。这些命令其实也很简单,我在这里归纳总结下吧。

一、查看主板
查看主板型号

Code example:

dmidecode -t baseboard

SMBIOS 2.4 present.

Handle 0x0002, DMItype 2, 8 bytes

Base Board Information

        Manufacturer: Gigabyte Technology Co., Ltd.

        Product Name: G41MT-D3   #这是我的主板型号啦

        Version:

        Serial Number:

查看BIOS信息

Code example:

dmidecode -t bios

......

BIOS Information

    Vendor: American Megatrends Inc.

    Version: 4.6.5

    Release Date: 04/25/2012

    .......

    BIOS Revision: 4.6

......

二、查看CPU
通过lscpu命令查看

Code example:

lscpu

Architecture:          x86_64

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

CPU(s):                1

Thread(s) per core:    1

Core(s) per socket:    1

CPU socket(s):         1

NUMA node(s):          1

Vendor ID:             GenuineIntel

CPU family:            15

Model:                 4

Stepping:              9

CPU MHz:               2800.135

L1d cache:             16K

L2 cache:              256K

查看/proc/cpuinfo文件,获取CPU详细参数。

Code example:

cat /proc/cpuinfo

processor       : 0

vendor_id       : GenuineIntel

cpu family      : 15

model           : 4

model name      : Intel(R) Celeron(R) CPU 2.80GHz  #CPU型号

stepping        : 9

cpu MHz         : 2800.135

cache size      : 256 KB

fpu             :yes

fpu_exception   :yes

cpuid level     : 5

wp              :yes

flags           : fpu vme de pse tsc msr pae mce...

bogomips        : 5600.27

clflush size    : 64

cache_alignment : 128

address sizes   : 36 bits physical, 48 bits virtual

power management:

三、查看内存
内存使用情况

Code example:

free -m

             total       used      free     shared    buffers     cached

Mem:          1977       1254        722          0        150        564

-/+ buffers/cache:        539       1438

Swap:         3858          0       3858

内存硬件信息

Code example:

dmidecode -t memory

SMBIOS 2.7 present.

Handle 0x0008, DMItype 16, 23 bytes

Physical Memory Array

    Location: System Board Or Motherboard

....

    Maximum Capacity: 32 GB

....

Handle 0x000A, DMItype 17, 34 bytes

....

Memory Device

    Array Handle: 0x0008

    Error Information Handle: Not Provided

    Total Width: 64 bits

    Data Width: 64 bits

    Size: 4096 MB

.....

四、查看网卡
网卡型号

Code example:

lspci|grep-i 'eth'

02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168BPCI Express Gigabit Ethernet controller (rev 06)

参数和指标

Code example:

ethtooleth0

Settings foreth0:

    Supported ports: [ TP MII ]

    Supported link modes:   10baseT/Half10baseT/Full

baseT/Half100baseT/Full

baseT/Half1000baseT/Full

    Supported pause frame use: No

    Supports auto-negotiation: Yes

    Advertised link modes:  10baseT/Half10baseT/Full

baseT/Half100baseT/Full

baseT/Half1000baseT/Full

    Advertised pause frame use: Symmetric Receive-only

    Advertised auto-negotiation: Yes

    Link partner advertised link modes:  10baseT/Half10baseT/Full

baseT/Half100baseT/Full

    .....

    Speed: 100Mb/s

    Duplex: Full

    .....

    Link detected:yes

五、查看硬盘
挂载和使用情况

Code example:

df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda1            323M  148M  159M  49% /

tmpfs                 989M     0  989M   0%/lib/init/rw

udev                  984M  172K  984M   1%/dev

tmpfs                 989M     0  989M   0%/dev/shm

/dev/sda9            444G   62G  360G  15% /home

/dev/sda8            368M   11M  339M   3% /tmp

/dev/sda5            8.3G  1.5G  6.5G  19% /usr

/dev/sda6            2.8G  551M  2.1G  21% /var

分区详细信息

Code example:

fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes

255 heads, 63 sectors/track, 60801 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/Osize (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0001ef9d

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1  *           1          43      340992   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2             43       60802   488042497    5  Extended

/dev/sda5             43        1137     8787968   83  Linux

/dev/sda6           1137        1502     2928640   83  Linux

/dev/sda7           1502        1994     3951616   82  Linux swap / Solaris

/dev/sda8           1994        2043      389120   83  Linux

/dev/sda9           2043       60802   471981056   83  Linux

Logo

更多推荐