查看机器的SN号以及dmidecode的使用

标签: 服务器  常用命令

windows查看sn

wmic bios get serialnumber
在这里插入图片描述
在这里插入图片描述

Linux查看sn方式

[[email protected] ~]# dmidecode -s system-serial-number

在这里插入图片描述
1、单独查看服务器的序列号

[[email protected] ~]# dmidecode -t system | grep 'Serial Number' 
    Serial Number: 2102310YPY10J30*****

2、单独查看服务器型号

[[email protected] ~]# dmidecode | grep "Product"
    Product Name: PowerEdge R730
    Product Name: 0WCJNT

3、统一查看服务器SN序列号和型号

[[email protected] ~]# dmidecode | grep "System Information" -A9 | egrep "Manufacturer|Product|Serial"
    Manufacturer: Huawei                    厂商
    Product Name: RH2288 V3              型号
    Serial Number: 2102310YPY10J3******       序列号

4、查看内存条信息及使用情况(内存的插槽数,已经使用多少插槽.每条内存多大,下图为16个内存插糟,用了12个插槽,每根内存条16G)

[[email protected] ~]# dmidecode -t memory | grep Size
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: No Module Installed
    Size: 16384 MB
    Size: No Module Installed
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: No Module Installed
    Size: 16384 MB
    Size: No Module Installed

扩展

查看服务器型号、SN、Raid等信息

三、安装Dmidecode:

Dmidecode 在主流的 Linux 发行版中都可以找到,只需通过所用发行版的包管理器安装即可,如:

apt-get install dmidecode
# Debian/Ubuntu
yum install dmidecode
# RHEL/CentOS/Fedora
pacman -S dmidecode
# Arch Linux
emerge -av dmidecode
# Gentoo

或者使用官方源码包安装:
Dmidecode源码包下载地址:http://download.savannah.gnu.org/releases/dmidecode/
Win版本下载地址:http://gnuwin32.sourceforge.net/packages/dmidecode.htm
(1)获取系统信息,例如:dmidecode -t 1
在这里插入图片描述
(2)获取主板信息:

[[email protected] docker]# dmidecode -t 2
# dmidecode 2.12
SMBIOS 2.4 present.
Handle 0x0001, DMI type 1, 27 bytes
System Information
	Manufacturer: VMware, Inc.
	Product Name: VMware Virtual Platform
	Version: None
	Serial Number: VMware-56 2d 6f cf 37 7b b6 ee-2b 86 0f 6b 26 e5 4f 37
	UUID: 564D6FCF-C77B-B6EE-2B26-0F6B25E02F07
	Wake-up Type: Power Switch
	SKU Number: Not Specified
	Family: Not Specified

(3)获取CPU ID

dmidecode -t 4 | grep ID

(4)获取系统序列号

dmidecode  | grep  Serial 

2、dmidecode -s [关键字] 指令

例如,查看处理器生产厂家:

[[email protected] docker]# dmidecode -s processor-manufacturer

附Windows 获取CPU ID等硬件信息(使用wmic):

(1)查看cpu序列号:

wmic cpu get processorid

(2)查看主板序列号:

wmic baseboard get serialnumber

(3)查看bios序列号:

wmic bios get serialnumber

(4)查看网卡信息:

wmic nicconfig get macaddress

获取硬件上的信息

vi cpu.sh


#!/usr/bin/bash
#get system information
 
echo -e "\033[49;31m System Information:  \033[0m" 
#版本信息
echo -e "\033[49;31m os-release:  \033[0m" `cat /etc/os-release | grep PRETTY_NAME= | awk -F'"' '{print $2}'`
echo -e "\033[49;31m Kernel:  \033[0m" `uname -r`
echo -e "\033[49;31m Packages-installed:  \033[0m" `dnf list installed |wc -l`
echo -e "\033[49;31m SHELL:  \033[0m" $SHELL
 
#主板信息,系统硬件的详细信息都可用dmidecode命令查看 ,shell学的不到位,信息截取出问题,没法和其他信息一样格式,~V~
echo 
echo `dmidecode |grep -A2 "System Information"` 
echo `dmidecode |grep -A2 "Base Board Information"`
 
#CPU信息
echo 
echo -e "\033[49;31m CPUModeName: \033[0m" `cat /proc/cpuinfo | grep 'model name' |uniq |awk -F ":" '{print $2}'`
echo -e "\033[49;31m Number of CPUs: \033[0m" `cat /proc/cpuinfo | grep "physical id" | uniq | wc -l`
echo -e "\033[49;31m cores of CPU: \033[0m" `cat /proc/cpuinfo | grep "cpu cores" | uniq |awk -F ":" '{print $2}'`
echo -e "\033[49;31m Processor of CPU: \033[0m" `cat /proc/cpuinfo |grep "processor" |wc -l`
 
#内存信息
echo 
echo -e "\033[49;31m MemoryManufacturer: \033[0m" `dmidecode -t memory | grep Manufacturer |awk -F ":" '{print $2}'`
echo -e "\033[49;31m Number of Memory: \033[0m" `dmidecode |grep "Associated Memory Slots" |awk -F ":" '{print $2}'`
echo -e "\033[49;31m MemorySize: \033[0m" `free -h |grep Mem |awk -F " " '{print $2}'`
echo -e "\033[49;31m SWAP: \033[0m" `free -h |grep Swap |awk -F " " '{print $2}'`
 
 
#硬盘信息
echo 
echo -e "\033[49;31m DISK: \033[0m" `fdisk -l |grep "Disk /dev/sd" |awk -F "," '{print $1}' |awk '{print $2 $3 $4}'`

在这里插入图片描述

shell获取Linux主机信息(mac地址,处理器,主板,uuid,硬盘)的方法

用法示例:

1、查看服务器型号:dmidecode | grep 'Product Name'

2、查看主板的序列号:dmidecode |grep 'Serial Number'

3、查看系统序列号:dmidecode -s system-serial-number

4、查看内存信息:dmidecode -t memory

5、查看OEM信息:dmidecode -t 11
6、获取CPU ID :  dmidecode -t 4 | grep ID
7、获取系统序列号 : dmidecode|grep  Serial 

8910

参考链接 :

https://blog.csdn.net/weixin_33943347/article/details/92809106
:https://www.cnblogs.com/wangzy-tongq/p/11290671.html

原文链接:加载失败,请重新获取