• Linux——查看系统硬件信息


    前言:下面实验的信息是我在几台配置不同服务器的测试结果,操作系统分别为Red Hat Enterprise Linux Server release 6.0 (Santiago)、Ubuntu 7.10。所以你看到我实验信息的不同时,请不要大惊小怪。而且有些命令也不是所有Linux操作系统都支持(例如在Ubuntu 7.10就不支持dmesg),下面的内容是收集整理的,如有错误或新的方法,也会不停整理、更新。

    一:查看CPU信息

    1、CPU详细信息

    方法1:CPU信息一般保存在proc目录下的cpuinfo文件中。如下所示。

    [root@DB-Server ~]# more /proc/cpuinfo
    processor       : 0
    vendor_id       : AuthenticAMD
    cpu family      : 16
    model           : 5
    model name      : AMD Athlon(tm) II X3 450 Processor
    stepping        : 3
    cpu MHz         : 800.000
    cache size      : 512 KB
    physical id     : 0
    siblings        : 3
    core id         : 0
    cpu cores       : 3
    apicid          : 0
    initial apicid  : 0
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 5
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat 
    pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 
    3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 po
    pcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefet
    ch osvw ibs skinit wdt npt lbrv svm_lock nrip_save
    bogomips        : 6428.41
    TLB size        : 1024 4K pages
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 48 bits physical, 48 bits virtual
    power management: ts ttp tm stc 100mhzsteps hwpstate
    
    processor       : 1
    vendor_id       : AuthenticAMD
    cpu family      : 16
    model           : 5
    model name      : AMD Athlon(tm) II X3 450 Processor
    stepping        : 3
    cpu MHz         : 800.000  --注意:AMD的CPU的频率会调整
    cache size      : 512 KB
    physical id     : 0
    siblings        : 3
    core id         : 1
    cpu cores       : 3
    apicid          : 1
    initial apicid  : 1
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 5
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext
     fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy 
    svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt npt lbrv svm_lock nrip_save
    bogomips        : 6428.64
    TLB size        : 1024 4K pages
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 48 bits physical, 48 bits virtual
    power management: ts ttp tm stc 100mhzsteps hwpstate
    
    processor       : 2
    vendor_id       : AuthenticAMD
    cpu family      : 16
    model           : 5
    model name      : AMD Athlon(tm) II X3 450 Processor
    stepping        : 3
    cpu MHz         : 800.000
    cache size      : 512 KB
    physical id     : 0
    siblings        : 3
    core id         : 2
    cpu cores       : 3
    apicid          : 2
    initial apicid  : 2
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 5
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext
     fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy 
    svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt npt lbrv svm_lock nrip_save
    bogomips        : 6428.63
    TLB size        : 1024 4K pages
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 48 bits physical, 48 bits virtual
    power management: ts ttp tm stc 100mhzsteps hwpstate
    

    方法2:使用dmesg命令(注意CPU应为大写)

    复制代码
    [root@m1 ~]$dmesg | grep CPU
    
    SMP: Allowing 8 CPUs, 5 hotplug CPUs
    
    NR_CPUS:4096 nr_cpumask_bits:8 nr_cpu_ids:8 nr_node_ids:1
    
    PERCPU: Embedded 31 pages/cpu @ffff880028200000 s95064 r8192 d23720 u262144
    
    CPU: Physical Processor ID: 0
    
    CPU: Processor Core ID: 0
    
    mce: CPU supports 6 MCE banks
    
    CPU0: AMD Athlon(tm) II X3 450 Processor stepping 03
    
    Brought up 3 CPUs
    
    processor LNXCPU:00: registered as cooling_device0
    
    processor LNXCPU:01: registered as cooling_device1
    
    processor LNXCPU:02: registered as cooling_device2
    复制代码

    方法3:使用dmidecode查看CPU信息

    View Code
    复制代码
    [root@DB-Server ~]# dmidecode -t processor
    
    # dmidecode 2.10
    
    SMBIOS 2.4 present.
    
    Handle 0x0004, DMI type 4, 35 bytes
    
    Processor Information
    
    Socket Designation: Socket M2
    
    Type: Central Processor
    
    Family: Athlon
    
    Manufacturer: AMD
    
    ID: 53 0F 10 00 FF FB 8B 17
    
    Signature: Family 16, Model 5, Stepping 3
    
    FlagsPGE (Page global enable)
    
    :
    
    FPU (Floating-point unit on-chip)
    
    VME (Virtual mode extension)
    
    DE (Debugging extension)
    
    PSE (Page size extension)
    
    TSC (Time stamp counter)
    
    MSR (Model specific registers)
    
    PAE (Physical address extension)
    
    MCE (Machine check exception)
    
    CX8 (CMPXCHG8 instruction supported)
    
    APIC (On-chip APIC hardware supported)
    
    SEP (Fast system call)
    
    MTRR (Memory type range registers)MCA (Machine check architecture)
    
    CMOV (Conditional move instruction supported)
    
    PAT (Page attribute table)
    
    PSE-36 (36-bit page size extension)
    
    CLFSH (CLFLUSH instruction supported)
    
    MMX (MMX technology supported)
    
    FXSR (Fast floating-point save and restore)
    
    SSE (Streaming SIMD extensions)
    
    SSE2 (Streaming SIMD extensions 2)
    
    HTT (Hyper-threading technology)
    
    Version: AMD Athlon(tm) II X3 450 Processor
    
    Voltage: 1.6 V
    
    External Clock: 200 MHz
    
    Max Speed: 3000 MHz
    
    Current Speed: 3200 MHz
    
    Status: Populated, Enabled
    
    Upgrade: Socket 754
    
    L1 Cache Handle: 0x0008
    
    L2 Cache Handle: 0x000A
    
    L3 Cache Handle: Not Provided
    
    Serial Number:
    
    Asset Tag:
    
    Part Number:
    复制代码

    2、查看物理CPU个数

    复制代码
    [root@DB-Server ~]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
    
    1
    
    [root@DB-Server ~]# dmesg | grep CPU | grep "Physical Processor ID" | uniq | wc -l
    
    1
    复制代码

    3、查看逻辑CPU个数

    复制代码
    [root@DB-Server ~]# cat /proc/cpuinfo | grep "processor" | wc -l
    
    3
    
    [root@DB-Server ~]# dmesg | grep "CPU" | grep "processor" | wc -l
    
    3
    复制代码

    4、查看CPU是几核的

    [root@DB-Server ~]# cat /proc/cpuinfo | grep "cores" | uniq
    
    cpu cores : 3

    5、查看CPU的主频

    复制代码
    [root@DB-Server ~]# cat /proc/cpuinfo | grep MHz | uniq
    
    cpu MHz : 800.000
    
    [root@DB-Server ~]# cat /proc/cpuinfo | grep MHz
    
    cpu MHz : 800.000
    
    cpu MHz : 800.000
    
    cpu MHz : 800.000
    复制代码

    6、查看CPU型号信息

    复制代码
    [root@DB-Server ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
    
    3 AMD Athlon(tm) II X3 450 Processor
    复制代码

    7、通过physical id 可以判断物理CPU个数

    复制代码
    [root@DB-Server ~]# cat /proc/cpuinfo | grep physical | uniq -c
    
    1 physical id : 0
    
    1 address sizes : 48 bits physical, 48 bits virtual
    
    1 physical id : 0
    
    1 address sizes : 48 bits physical, 48 bits virtual
    
    1 physical id : 0
    
    1 address sizes : 48 bits physical, 48 bits virtual
    复制代码

    8、查看CPU是否支持64位运算

    复制代码
    [root@DB-Server ~]# cat /proc/cpuinfo | grep flags | grep 'lm' | wc -l
    
    3
    
    结果大于0,说明支持64位运算,lm指long mode 支持lm则是64bit
    复制代码
    复制代码
    [root@DB-Server ~]# getconf LONG_BIT
    
    64
    
    etl:/home/etl/$getconf LONG_BIT(另外一台服务器)
    
    32
    
    说明当前CPU运行在32位模式下,当不代表CPU不支持64位
    复制代码

    二、 查看内存信息

    View Code

    你也可以用free命令查看

    View Code

    查看内存条型号

    View Code

    三:查看磁盘信息 

    View Code
    View Code
    View Code
    View Code
    View Code

    四:查看网卡信息

    1. mii-tool 指令来查看网卡信息。它主要是用于配置网卡工作模式的指令,同时也可以用于查询、监控工作。

    2. 直接输入dmesg可以看到开机检测到硬件信息

    3. ethtool eth0 采用此命令查到网卡相关的技术指标 (不一定所有网卡支持都支持此命令)

    4. more /etc/sysconfig/network-scripts/ifcfg-eth0 用这个可以看到网卡的信息

    5. ifconfig

    6. lspci

    网卡配置文件

    每一个网络介质都对应一个配置文件,超级用户可以通过这些配置文件来配置网卡

    网卡配置文件存放在/etc/sysconfig/network-scripts/目录中

    /etc/sysconfig/network-scripts/ifcfg-interface-name

    设置文件ifcfg-interface-name包含了初始化接口所需的大部分周详信息,其中interface-name将根据网卡的类型和排序而不同,一般其名字为eth0、eth1、ppp0等,

    其中eth表示以太(eth0)类型网卡,0表示第一块网卡、1表示第二块网卡,而ppp0则表示point-to-poirt protocol网络接口。在ifcfg文件中定义的各项目取决于接口类型。

    DEVICE=name 其中name是物理设备名

    IPADDR=addr 其中addr是IP地址

    NETMASK=mask 其中mask是网络掩码值

    NETWORK=addr 其中addr是网络地址

    BROADCAST=addr 其中addr是广播地址

    GATEWAY=addr 其中addr是网关地址

    ONBOOT=answer 其中answer是yes(引导时激活设备)或no(引导时不激活设备)

    USECTL=answer 其中answer是yes(非root用户能控制该设备)或no

    BOOTPROTO=proto

    [root@DB-Server ~]# ethtool eth0

    Settings for eth0:

    Supported ports: [ TP ]

    Supported link modes: 10baseT/Half 10baseT/Full

    100baseT/Half 100baseT/Full

    1000baseT/Full

    Supports auto-negotiation: Yes

    Advertised link modes: 10baseT/Half 10baseT/Full

    100baseT/Half 100baseT/Full

    1000baseT/Full

    Advertised pause frame use: No

    Advertised auto-negotiation: Yes

    Speed: 100Mb/s

    Duplex: Full

    Port: Twisted Pair

    PHYAD: 0

    Transceiver: internal

    Auto-negotiation: on

    MDI-X: Unknown

    Supports Wake-on: pg

    Wake-on: d

    Current message level: 0x00000001 (1)

    Link detected: yes

    ethtool -i eth0 加上-i查看网卡驱动

    [root@DB-Server ~]# ethtool -i eth0

    driver: ATL1C

    version: 1.0.1.14

    firmware-version: L1e

    bus-info: 0000:02:00.0

    [root@DB-Server ~]# dmesg | grep eth0

    atheros_eth 0000:02:00.0: ATL1C: eth0 NIC Link is Up<100 Mbps Full Duplex>

    [root@DB-Server ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0

    DEVICE=eth0

    IPADDR=172.20.32.97

    NETMASK=255.255.248.0

    GATEWAY=172.20.39.251

    DNS1=172.20.0.11

    ONBOOT=yes

    HWADDR=50:e5:49:df:b0:8b

    BOOTPROTO=none

    TYPE=Ethernet

    IPV6INIT=no

    USERCTL=no

    [root@DB-Server ~]# mii-tool

    eth0: negotiated 100baseTx-FD, link ok

    五:查看主板信息

    View Code

    六:查看显卡信息

    [root@DB-Server ~]# lspci |grep VGA

    01:05.0 VGA compatible controller: ATI Technologies Inc 760G [Radeon 3000]

    作者:潇湘隐者

    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接.
  • 相关阅读:
    Web上传大文件的解决方案
    JS上传大文件的解决方案
    网页上传大文件的解决方案
    B/S上传大文件的解决方案
    Unity UGUI——提供可视功能的UI组件(Text)
    Java设计模式透析之 —— 策略(Strategy)
    【边做项目边学Android】小白会遇到的问题--Appcompat_V7问题
    高度平衡树 -- AVL 树
    成长这事儿,不可不说-------Day36
    Cocos2D-X2.2.3学习笔记5(UI系统)
  • 原文地址:https://www.cnblogs.com/Leo_wl/p/2578847.html
Copyright © 2020-2023  润新知