当前位置:网站首页 > 资讯百科 > 科技知识 > 正文

linux查看操作系统版本信息命令(附9个实例解说手机Linux实用命令)

小武-网站专员小武-网站专员 2022-03-30 16:57:28 299

手机系统Linux下,我们经常需要查看系统的硬件信息, 这里我罗列了查看系统硬件信息的实用命令,并做了分类,实例解说。

执行环境:ubuntu 16.04

1. cpu

lscpu命令,查看的是cpu的统计信息.

root@ubuntu:/home/peng/#lscpuArchitecture:x86_64#cpu架构CPUop-mode(s):32-bit,64-bitByteOrder:LittleEndian#小尾序CPU(s):1#总共有1核   On-lineCPU(s)list:0Thread(s)percore:1#每个cpu核,只能支持一个线程,即不支持超线程 Core(s)persocket:1Socket(s):1NUMAnode(s):1VendorID:GenuineIntel#cpu产商 intelCPUfamily:6Model:158Modelname:Intel(R)Core(TM)i5-7500CPU@3.40GHzStepping:9CPUMHz:3408.070BogoMIPS:6816.14Hypervisorvendor:VMwareVirtualizationtype:full#支持cpu虚拟化技术L1dcache:32KL1icache:32KL2cache:256KL3cache:6144KNUMAnode0CPU(s):0

查看/proc/cpuinfo,可以知道每个cpu信息,如每个CPU的型号,主频等。

root@ubuntu:/home/peng#cat/proc/cpuinfoprocessor:0vendor_id:GenuineIntelcpufamily:6model:158modelname:Intel(R)Core(TM)i5-7500CPU@3.40GHzstepping:9microcode:0x48cpuMHz:3408.070cachesize:6144KBphysicalid:0siblings:1coreid:0cpucores:1apicid:0initialapicid:0fpu:yesfpu_exception:yescpuidlevel:22wp:yes.....

2. 内存

概要查看内存情况

root@ubuntu:/home/peng#free-mtotalusedfreesharedbuff/cacheavailableMem:1970702315139521025Swap:97420954

这里的单位是MB,总共的内存是1970MB。

查看内存详细使用

root@ubuntu:/home/peng# cat /proc/meminfo MemTotal:        2017516 kBMemFree:          242020 kBMemAvailable:    1003240 kBBuffers:          104192 kBCached:           699824 kBSwapCached:         1832 kBActive:           696320 kBInactive:         639924 kBActive(anon):     236412 kBInactive(anon):   301996 kBActive(file):     459908 kBInactive(file):   337928 kBUnevictable:          48 kBMlocked:              48 kB.....

查看内存硬件信息

root@ubuntu:/home/peng#dmidecode-tmemory# dmidecode 3.0                                                                                                                                                                                 GettingSMBIOSdatafromsysfs.SMBIOS2.7present.Handle0x0084,DMItype5,46bytesMemoryControllerInformationErrorDetectingMethod:NoneErrorCorrectingCapabilities:NoneSupportedInterleave:One-wayInterleaveCurrentInterleave:One-wayInterleaveMaximumMemoryModuleSize:32768MBMaximumTotalMemorySize:491520MBSupportedSpeeds:70ns60nsSupportedMemoryTypes:FPMEDODIMMSDRAMMemoryModuleVoltage:3.3VAssociatedMemorySlots:15.....

内存最大值是 491520 MB。

3. 磁盘

查看硬盘和分区分布

root@ubuntu:/home/peng#lsblkNAMEMAJ:MINRMSIZEROTYPEMOUNTPOINTsr011:011024M0romsda8:00500G0disk├─sda28:201K0part├─sda58:50975M0part[SWAP]└─sda18:10499G0part/

查看硬盘和分区的详细信息

root@ubuntu:/home/peng#fdisk-lDisk/dev/sda:500GiB,536870912000bytes,1048576000sectorsUnits:sectorsof1*512=512bytesSectorsize(logical/physical):512bytes/512bytesI/Osize(minimum/optimal):512bytes/512bytesDisklabeltype:dosDiskidentifier:0x9c674a44DeviceBootStartEndSectorsSizeIdType/dev/sda1*204810465751031046573056499G83Linux/dev/sda2104657715010485739511996802975M5Extended/dev/sda5104657715210485739511996800975M82Linuxswap/Solaris

4. 网卡

查看网卡硬件信息

root@ubuntu:/home/peng# lspci | grep -i 'eth'02:01.0Ethernet controller:Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)

查看系统的所有网络接口

root@ubuntu:/home/peng# ifconfig-aens33Linkencap:EthernetHWaddr00:0c:29:bb:bd:40inetaddr:192.168.0.117Bcast:192.168.0.255Mask:255.255.255.0inet6addr: fe80::76fa:5548:3da0:2ef/64Scope:LinkUPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1RXpackets:174629errors:0dropped:0overruns:0frame:0TXpackets:105285errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:1000RXbytes:237519396(237.5MB)  TXbytes:9592767(9.5MB) loLinkencap:LocalLoopbackinetaddr:127.0.0.1Mask:255.0.0.0inet6addr: ::1/128Scope:HostUPLOOPBACKRUNNINGMTU:65536Metric:1RXpackets:854errors:0dropped:0overruns:0frame:0TXpackets:854errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:1000RXbytes:60894(60.8KB)  TXbytes:60894(60.8KB)

或者是

root@ubuntu:/home/peng#iplinkshow1:lo:<LOOPBACK,UP,LOWER_UP>mtu65536qdiscnoqueuestateUNKNOWNmodeDEFAULTgroupdefaultqlen1000link/loopback00:00:00:00:00:00brd00:00:00:00:00:002:ens33:<BROADCAST,MULTICAST,UP,LOWER_UP>mtu1500qdiscpfifo_faststateUPmodeDEFAULTgroupdefaultqlen1000link/ether00:0c:29:bb:bd:40brdff:ff:ff:ff:ff:ff

或者

linux查看操作系统版本信息命令(附9个实例解说手机Linux实用命令)

如果要查看某个网络接口的详细信息,例如ens33的详细参数和指标

【有的ubuntu网口是eth0】

root@ubuntu:/home/peng# ethtool ens33Settings for ens33:  Supported ports: [ TP ]  Supported link modes:   10baseT/Half 10baseT/Full                           100baseT/Half 100baseT/Full #支持千兆半双工,全双工模式1000baseT/Full   Supported pause frame use: NoSupports auto-negotiation: Yes #默认使用自适应模式Advertised linkmodes:  10baseT/Half 10baseT/Full100baseT/Half 100baseT/Full1000baseT/FullAdvertised pause frame use: NoAdvertised auto-negotiation: Yes  Speed: 1000Mb/s #网卡的速度是1000MbDuplex: Full#全双工Port: Twisted Pair  PHYAD: 0Transceiver: internal  Auto-negotiation: onMDI-X: off(auto)  Supports Wake-on: d  Wake-on: d  Currentmessage level: 0x00000007(7)           drv probe linkLinkdetected: yes   #表示有网线连接,和路由是通的

5. pci

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

root@ubuntu:/home/peng#lspci00:00.0Hostbridge:IntelCorporation82845845(Brookdale)ChipsetHostBridge(rev04)00:01.0PCIbridge:IntelCorporation82845845(Brookdale)ChipsetAGPBridge(rev04)00:1d.0USBController:IntelCorporation82801CA/CAMUSB(Hub#1) (rev 02)00:1d.1USBController:IntelCorporation82801CA/CAMUSB(Hub#2) (rev 02)00:1e.0PCIbridge:IntelCorporation82801MobilePCIBridge(rev42)00:1f.0ISAbridge:IntelCorporation82801CAMISABridge(LPC)(rev02)00:1f.1IDEinterface:IntelCorporation82801CAMIDEU100(rev02)00:1f.3SMBus:IntelCorporation82801CA/CAMSMBusController(rev02)00:1f.5Multimediaaudiocontroller:IntelCorporation82801CA/CAMAC'97AudioController(rev02)00:1f.6Modem:IntelCorporation82801CA/CAMAC'97ModemController(rev02)01:00.0VGAcompatiblecontroller:nVidiaCorporationNV17[GeForce4420Go](reva3)02:00.0FireWire(IEEE1394):VIATechnologies,Inc.IEEE1394HostController(rev46)02:01.0Ethernetcontroller:RealtekSemiconductorCo.,Ltd.RTL-8139/8139C/8139C+(rev10)02:04.0CardBusbridge:O2Micro,Inc.OZ6933CardbusController(rev01)02:04.1CardBusbridge:O2Micro,Inc.OZ6933CardbusController(rev01)

由上述的 输出可以看到,我的电脑上共有3个PCI总线(0号,1号,2号)。在单个系统上,插入多个总线是通过桥(bridge)来完成的,桥是一种用来连接总线 的特殊PCI外设。所以,PCI系统的整体布局组织为树型,我们可以通过上面的lspci输出,来画出我的电脑上的PCI系统的树型结构:

00:00.0(主桥)--00:01.0(PCI桥)-----01:00:0(nVidia显卡)                    |                    |---00:1d(USB控制器)--00:1d:0(USB1号控制器)                    |                    |                    |                    |--00:1d:1(USB2号控制器)                    |                    |-00:1e:0(PCI桥)--02:00.0(IEEE1394)                    |                |                    |                |-02:01.0(8139网卡)                    |                |                    |                |-02:04(CardBus桥)-02:04.0(桥1)                    |                                   |                    |                                   |--02:04.1(桥2)                    |                    |-00:1f(多功能板卡)-00:1f:0(ISA桥)                                         |                                         |--00:1f:1(IDE接口)                                         |                                         |--00:1f:3(SMBus)                                         |                                         |--00:1f:5(多媒体声音控制器)                                         |                                         |--00:1f:6(调制解调器)

由上图可以得出,我的电脑上共有8个PCI设备,其中0号总线上(主桥)上连有4个,1号总线上连有1个,2号总线上连有3个。00:1f是一个连有5个功能的多功能板卡。

如果要更详细的信息:

lspci-v 或者 lspci -vv

如果要看设备树:lscpi -t

root@ubuntu:/home/peng# lspci -t

6. usb

查看usb信息

root@ubuntu:/home/peng#lsusbBus001Device001:ID1d6b:0002LinuxFoundation2.0roothubBus002Device003:ID0e0f:0002VMware,Inc.VirtualUSBHubBus002Device002:ID0e0f:0003VMware,Inc.VirtualMouseBus002Device001:ID1d6b:0001LinuxFoundation1.1roothub

lsusb -t查看系统中的USB拓扑,类似cat /sys/kernel/debug/usb/devices

root@ubuntu:/home/peng#lsusb-t/:Bus02.Port1:Dev1,Class=root_hub,Driver=uhci_hcd/2p,12M|__Port1:Dev2,If0,Class=HumanInterfaceDevice,Driver=usbhid,12M|__Port2:Dev3,If0,Class=Hub,Driver=hub/7p,12M/:Bus01.Port1:Dev1,Class=root_hub,Driver=ehci-pci/6p,480M

/var/lib/usbutils/usb.ids还保存了很多设备商的VID信息

root@ubuntu:/home/peng#cat/var/lib/usbutils/usb.ids|grepKing7778Counterfeitflashdrive[Kingston]0100KingstonFlashDrive(128MB)c010KingstonFCR-HS2/ATACardReader07cbKingmaxTechnology,Inc.4100KingsunSF-620InfraredAdapter4959KingsunKS-959InfraredAdapter0015KingstonDataTravelerELITE0016KingstonDataTravelerU30998KingstonDataTraveler2.0DiskDriver0999KingstonDataTraveler2.0DiskDriver6519KingstonDataTraveler2.0USBStick653cKingstonDataTraveler2.0Stick(512M)653dKingstonDataTraveler2.0Stick(1GB)6544TransMemory-Mini/KingstonDataTraveler2.0Stick(2GB)6545KingstonDataTraveler102/2.0/HEMAFlashDrive2GB/PNYAttache4GBStick0951KingstonTechnology0d8aKingJimCo.,Ltd00a3SmartKingPROUninterruptiblePowerSupply(HIDPDC)0e56KingstonTechnologyCompany,Inc.0f8eKingnetTechnologyCo.,Ltd13feKingstonTechnologyCompanyInc.1f00KingstonDataTraveler/PatriotXporter1687KingmaxDigitalInc.16dfKingBillionElectronicsCo.,Ltd.2149EntropyKingRandomNumberGenerator

lsusb -v查看系统中USB设备的详细信息

lsusb-v

7. lshw查看所有硬件摘要信息

下面命令可以查看所有硬件摘要信息,并输出成一个html文件,把此html文件导出到电脑上,直接打开,可以清楚的看到硬件信息:

lshw-html > /hardware.html

8. lsscsi查看SCSI控制器设备的信息

可以看到SCSI信息和所有虚拟磁盘以及光驱的信息,如果没有硬件SCSI控制器,那就不会返回信息:

root@ubuntu:/home/peng# lsscsi[2:0:0:0]    disk    VMware,  VMware Virtual S 1.0/dev/sda  [4:0:0:0]    cd/dvd  NECVMWar VMware SATA CD01 1.00/dev/sr0

插入一个U盘后再查看:

root@ubuntu:/home/peng# lsscsi[2:0:0:0]    disk    VMware,  VMware Virtual S 1.0/dev/sda  [4:0:0:0]    cd/dvd  NECVMWar VMware SATA CD01 1.00/dev/sr0[33:0:0:0]   disk    Kingston DataTraveler G2  1.00/dev/sdb 

可以看到U盘为Kingston。

9. 查看bios信息

root@ubuntu:/home/peng# dmidecode -t bios# dmidecode 3.0Getting SMBIOS data from sysfs. SMBIOS 2.7 present. Handle 0x0000, DMI type 0, 24 bytes BIOS Information  Vendor: Phoenix Technologies LTD  Version: 6.00  ReleaseDate: 07/29/2019Address: 0xEA480Runtime Size: 88960bytesROM Size: 64kB  Characteristics:   ISA issupported   PCI issupported   PC Card (PCMCIA) issupported   PNP issupported   APM issupported   BIOS isupgradeable   BIOS shadowing isallowed   ESCD support isavailable   Boot fromCD issupported   Selectable boot issupported   EDD issupported   Print screen service issupported (int5h)   8042keyboard services aresupported (int9h)   Serialservices aresupported (int14h)   Printer services aresupported (int17h)   CGA/mono video services aresupported (int10h)   ACPI issupported   Smart battery issupported   BIOS boot specification issupported   Functionkey-initiated network boot issupported   Targeted contentdistribution issupported  BIOS Revision: 4.6Firmware Revision: 0.0

dmidecode以一种可读的方式dump出机器的DMI(Desktop Management Interface)信息。这些信息包括了硬件以及BIOS,既可以得到当前的配置,也可以得到系统支持的最大配置,比如说支持的最大内存数等。

如果要查看所有有用的信息

dmidecode-q

里面包含了很多硬件信息。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 3561739510@qq.com 举报,一经查实,本站将立刻删除。

转载请注明来自专注SEO技术,教程,推广 - 8848SEO,本文标题:《linux查看操作系统版本信息命令(附9个实例解说手机Linux实用命令)》

标签:

关于我

关注微信送SEO教程

搜索
最新文章
热门文章
热门tag
抖音优化提升网站排名百度SEO优化网站优化提高网站排名抖音小店SEO优化SEO优化技巧网站SEO优化网站排名seo优化seo网站优化关键词优化百度SEO排名小红书关键词排名seoSEO优化排名搜索引擎优化
友情链接