linux系统的服务器中查看CPU、硬盘、内存、主板等系统信息及硬件信息

原创
2017/12/06 15:40
阅读数 3.2K

 

一、linux下查看内存条数及每根内存大小的实现方法

    1) 命令如下:

# linux下查看内存条数及每根内存大小的实现方法
dmidecode | grep -A16 "Memory Device$"

    root权限下执行之后信息示例:


[root@localhost weblogic]# dmidecode | grep -A16 "Memory Device$"
Memory Device
        Array Handle: 0x002B
        Error Information Handle: Not Provided
        Total Width: Unknown
        Data Width: Unknown
        Size: No Module Installed
        Form Factor: DIMM
        Set: None
        Locator: DIMM A2
        Bank Locator: BANK 0
        Type: DDR3
        Type Detail: Unbuffered (Unregistered)
        Speed: Unknown
        Manufacturer: Not Specified
        Serial Number: Not Specified
        Asset Tag: Not Specified
        Part Number: Not Specified
--
Memory Device
        Array Handle: 0x002B
        Error Information Handle: No Error
        Total Width: 72 bits
        Data Width: 64 bits
        Size: 8192 MB
        Form Factor: DIMM
        Set: None
        Locator: DIMM A1
        Bank Locator: BANK 1
        Type: DDR3
        Type Detail: Synchronous Unbuffered (Unregistered)
        Speed: 1600 MHz
        Manufacturer: 80CE000080CE
        Serial Number: 20685F8E
        Asset Tag: 031512
        Part Number: M391B1G73QH0-YK0
--
Memory Device
        Array Handle: 0x002B
        Error Information Handle: Not Provided
        Total Width: Unknown
        Data Width: Unknown
        Size: No Module Installed
        Form Factor: DIMM
        Set: None
        Locator: DIMM B2
        Bank Locator: BANK 2
        Type: DDR3
        Type Detail: Unbuffered (Unregistered)
        Speed: Unknown
        Manufacturer: Not Specified
        Serial Number: Not Specified
        Asset Tag: Not Specified
        Part Number: Not Specified
--
Memory Device
        Array Handle: 0x002B
        Error Information Handle: Not Provided
        Total Width: Unknown
        Data Width: Unknown
        Size: No Module Installed
        Form Factor: DIMM
        Set: None
        Locator: DIMM B1
        Bank Locator: BANK 3
        Type: DDR3
        Type Detail: Unbuffered (Unregistered)
        Speed: Unknown
        Manufacturer: Not Specified
        Serial Number: Not Specified
        Asset Tag: Not Specified
        Part Number: Not Specified

    2) 命令如下:

# 服务器到底能扩展到多大的内存
dmidecode -t 16

    root权限下执行之后信息示例:

[root@localhost docker]# dmidecode -t 16
# dmidecode 2.12
SMBIOS 2.7 present.

Handle 0x002B, DMI type 16, 23 bytes
Physical Memory Array
        Location: System Board Or Motherboard
        Use: System Memory
        Error Correction Type: Multi-bit ECC
        Maximum Capacity: 32 GB
        Error Information Handle: No Error
        Number Of Devices: 4

 

二、 查看主板型号

    命令如下:

# 查看主板型号 
dmidecode |grep -A16 "System Information$"

    root权限下执行之后信息示例:

[root@localhost docker]# dmidecode |grep -A16 "System Information$"
System Information
        Manufacturer: Dell Inc.
        Product Name: PowerEdge T110 II
        Version: Not Specified
        Serial Number: 4856962
        UUID: 4C4C4544-0038-3510-8036-B4C04F393632
        Wake-up Type: Power Switch
        SKU Number: Not Specified
        Family: Not Specified

Handle 0x000C, DMI type 2, 9 bytes
Base Board Information
        Manufacturer: Dell Inc.
        Product Name: 0PC2WT
        Version: A06
        Serial Number: ..CN7082151S0QIS.
        Asset Tag: Not Specified

 

三、查看服务器上部署的Linux系统与内核信息

    1)命令如下:

# lsb_release -a (适用于所有的linux,包括Redhat、SuSE、Debian等发行版,但是在debian下要安装lsb)
lsb_release -a

    root权限下执行之后信息示例:

[root@localhost docker]# lsb_release -a
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description:    CentOS release 6.9 (Final)
Release:        6.9
Codename:       Final

    2)命令如下:

# 输入"cat /proc/version",说明正在运行的内核版本
cat /proc/version

     root权限下执行之后信息示例:

[root@localhost docker]# cat /proc/version
Linux version 2.6.32-696.13.2.el6.x86_64 (mockbuild@c1bl.rdu2.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP Thu Oct 5 21:22:16 UTC 2017

    3)命令如下:

# 输入"cat /etc/issue", 显示的是发行版本信息
cat /etc/issue

     root权限下执行之后信息示例:

[root@localhost docker]# cat /etc/issue
CentOS release 6.9 (Final)
Kernel \r on an \m

    4)命令如下:

# 输入"uname -a",可显示电脑以及操作系统的相关信息
uname -a

     root权限下执行之后信息示例:

[root@localhost docker]# uname -a
Linux localhost.localdomain 2.6.32-696.13.2.el6.x86_64 #1 SMP Thu Oct 5 21:22:16 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

 

四、查看服务器上的硬盘大小 

    命令如下:

# 硬盘大小详情
fdisk -l |grep Disk

     root权限下执行之后信息示例:

[root@localhost docker]#  fdisk -l |grep Disk
Disk /dev/sda: 500.1 GB, 500107862016 bytes
Disk identifier: 0x769d5702
Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/VolGroup-lv_swap: 10.5 GB, 10519314432 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/VolGroup-lv_home: 435.4 GB, 435372949504 bytes
Disk identifier: 0x00000000

 

五、在Linux服务器中查看CPU

    1)命令如下:

# linux CPU大小
cat /proc/cpuinfo |grep "model name" && cat /proc/cpuinfo |grep "physical id"

     root权限下执行之后信息示例:

[root@localhost docker]# cat /proc/cpuinfo |grep "model name" && cat /proc/cp                                                                           uinfo |grep "physical id"
model name      : Intel(R) Xeon(R) CPU E3-1220 V2 @ 3.10GHz
model name      : Intel(R) Xeon(R) CPU E3-1220 V2 @ 3.10GHz
model name      : Intel(R) Xeon(R) CPU E3-1220 V2 @ 3.10GHz
model name      : Intel(R) Xeon(R) CPU E3-1220 V2 @ 3.10GHz
physical id     : 0
physical id     : 0
physical id     : 0
physical id     : 0

    Tips:

    Linux下可以在/proc/cpuinfo中看到每个cpu的详细信息。但是对于双核的cpu,在cpuinfo中会看到两个cpu。常常会让人误以为是两个单核的cpu。
    其实应该通过Physical Processor ID来区分单核和双核。而Physical Processor ID可以从cpuinfo或者dmesg中找到. flags 如果有 ht 说明支持超线程技术 。
    判断物理CPU的个数可以查看physical id 的值,相同则为同一个物理CPU,可以看到上面,这台机器有一个四核的CPU,ID 是0,大小是3.1G。

    2)命令如下:

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

     root权限下执行之后信息示例: 

[root@localhost docker]# cat /proc/cpuinfo | grep "physical id" | uniq | wc -l
1

    3)命令如下:

# 查看CPU核数
cat /proc/cpuinfo | grep "cpu cores" | uniq

     root权限下执行之后信息示例: 

[root@localhost docker]# cat /proc/cpuinfo | grep "cpu cores" | uniq
cpu cores       : 4

    4)命令如下:

# 查看CPU型号
 cat /proc/cpuinfo | grep 'model name' |uniq

     root权限下执行之后信息示例: 

[root@localhost docker]# cat /proc/cpuinfo | grep 'model name' |uniq
model name      : Intel(R) Xeon(R) CPU E3-1220 V2 @ 3.10GHz

 

六、怎样查看 linux 的网卡信息

    1) 命令如下:

# 查看 linux 的网卡信息
ifconfig

     执行之后信息示例: 

[root@localhost docker]# ifconfig
eth0      Link encap:Ethernet  HWaddr F8:DB:88:FE:3A:FA
          inet addr:192.168.1.222  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::fadb:88ff:fefe:3afa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:406668 errors:0 dropped:0 overruns:0 frame:0
          TX packets:155262 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:41037516 (39.1 MiB)  TX bytes:23813933 (22.7 MiB)
          Interrupt:16

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:18475 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18475 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1957207 (1.8 MiB)  TX bytes:1957207 (1.8 MiB)

    2) 命令如下:

# 查看Linux下网卡状态 
# ip link 命令   或者 通过mii-tool指令
ip link

     执行之后信息示例: 

[root@localhost docker]# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether f8:db:88:fe:3a:fa brd ff:ff:ff:ff:ff:ff

 

本文为博主原创文章,转载请注明出处!

https://my.oschina.net/u/3375733/blog/

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部