linux查看cpu核数和内存大小命令分别为:
创新互联主营安泽网站建设的网络公司,主营网站建设方案,成都APP应用开发,安泽h5微信平台小程序开发搭建,安泽网站营销推广欢迎安泽等地区企业咨询
1、查罩御高看CPU个数*核心数:
cat /proc/cpuinfo | grep “physical id” | uniq | wc -l
96 #一物尺共96核
2、查看内存总数
#cat /proc/meminfo | grep MemTotal
MemTotal: 230993600 kB
Linux下查看CPU型号,内存大小,硬盘空间的命令:
1、查看CPU核数
cat /proc/cpuinfo | grep “cpu cores” | uniq
cpu cores : 12 #12是单颗CPU的核心数
2、查看CPU型号
cat /proc/cpuinfo | grep ‘model name’ |uniq
model name : Intel® Xeon® CPU E7-4830 v3 @ 2.10GHz
3、查看linux物理内拆虚存数量及大小
dmidecode -t memory | grep Size: | grep -v “No Module Installed”
lscpu命令,查看的是cpu的闷陪绝统计信息.\x0d\x0ablue@blue-pc:~$ lscpu\x0d\x0aArchitecture: i686 #cpu架构\x0d\x0aCPU op-mode(s): 32-bit, 64-bit\x0d\x0aByte Order: Little Endian #小尾序\x0d\x0aCPU(s): 4 #总共有4核\x0d\x0aOn-line CPU(s) list: 0-3\x0d\x0aThread(s) per core: 1 #每个cpu核,只能支持一个线程,即不支持超乱戚线程\x0d\x0aCore(s) per socket: 4 #每个cpu,有4个核\x0d\x0aSocket(s): 1 #总共有1一个cpu\x0d\x0aVendor ID: GenuineIntel #cpu产商 intel\x0d\x0aCPU family: 6\x0d\x0aModel: 42\x0d\x0aStepping: 7\x0d\x0aCPU MHz: 1600.000\x0d\x0aBogoMIPS: 5986.12\x0d\x0aVirtualization: VT-x #支持cpu虚拟化技术\x0d\x0aL1d cache: 32K\x0d\x0aL1i cache: 32K\x0d\x0aL2 cache: 256K\x0d\x0aL3 cache: 6144K\x0d\x0a \x0d\x0a 查看/proc/cpuinfo,可以知道每个cpu信息,如每个CPU的型号,主频等。\x0d\x0a#cat /proc/cpuinfo\x0d\x0aprocessor : 0\x0d\x0avendor_id : GenuineIntel\x0d\x0acpu family : 6\x0d\x0amodel : 42\x0d\x0amodel name : Intel(R) Core(TM) i5-2320 CPU @ 3.00GHz\x0d\x0a.....\x0d\x0a 上面输出的是第一个cpu部分信息,还有3个cpu信蚂姿息省略了。\x0d\x0a \x0d\x0a 内存\x0d\x0a 概要查看内存情况\x0d\x0a free -m\x0d\x0a total used free shared buffers cached\x0d\x0a Mem: 3926 3651 274 0 12 404\x0d\x0a -/+ buffers/cache: 3235 691\x0d\x0a Swap: 9536 31 9505\x0d\x0a 这里的单位是MB,总共的内存是3926MB。\x0d\x0a \x0d\x0a 查看内存详细使用\x0d\x0a# cat /proc/meminfo\x0d\x0aMemTotal: 4020868 kB\x0d\x0aMemFree: 230884 kB\x0d\x0aBuffers: 7600 kB\x0d\x0aCached: 454772 kB\x0d\x0aSwapCached: 836 kB\x0d\x0a.....\x0d\x0a \x0d\x0a 查看内存硬件信息\x0d\x0admidecode -t memory\x0d\x0a# dmidecode 2.11\x0d\x0aSMBIOS 2.7 present.\x0d\x0aHandle 0x0008, DMI type 16, 23 bytes\x0d\x0aPhysical Memory Array\x0d\x0a Location: System Board Or Motherboard\x0d\x0a....\x0d\x0a Maximum Capacity: 32 GB\x0d\x0a....\x0d\x0aHandle 0x000A, DMI type 17, 34 bytes\x0d\x0a....\x0d\x0aMemory Device\x0d\x0a Array Handle: 0x0008\x0d\x0a Error Information Handle: Not Provided\x0d\x0a Total Width: 64 bits\x0d\x0a Data Width: 64 bits\x0d\x0a Size: 4096 MB\x0d\x0a.....\x0d\x0a 我的主板有4个槽位,只用了一个槽位,上面插了一条4096MB的内存。\x0d\x0a \x0d\x0a 磁盘\x0d\x0a 查看硬盘和分区分布\x0d\x0a# lsblk\x0d\x0aNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT\x0d\x0asda 8:0 0 465.8G 0 disk\x0d\x0a├—sda1 8:1 0 1G 0 part /boot\x0d\x0a├—sda2 8:2 0 9.3G 0 part [SWAP]\x0d\x0a├—sda3 8:3 0 74.5G 0 part /\x0d\x0a├—sda4 8:4 0 1K 0 part\x0d\x0a├—sda5 8:5 0 111.8G 0 part /home\x0d\x0a└—sda6 8:6 0 269.2G 0 part\x0d\x0a 显示很直观\x0d\x0a \x0d\x0a 如果要看硬盘和分区的详细信息\x0d\x0a# fdisk -l\x0d\x0aDisk /dev/sda: 500.1 GB, 500107862016 bytes\x0d\x0a255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors\x0d\x0aUnits = sectors of 1 * 512 = 512 bytes\x0d\x0aSector size (logical/physical): 512 bytes / 4096 bytes\x0d\x0aI/O size (minimum/optimal): 4096 bytes / 4096 bytes\x0d\x0aDisk identifier: 0x00023728\x0d\x0a Device Boot Start End Blocks Id System\x0d\x0a/dev/sda1 * 2048 2148351 1073152 83 Linux\x0d\x0a/dev/sda2 2148352 21680127 9765888 82 Linux swap / Solaris\x0d\x0a/dev/sda3 21680128 177930239 78125056 83 Linux\x0d\x0a/dev/sda4 177932286 976771071 399419393 5 Extended/dev/sda5 177932288 412305407 117186560 83 Linux\x0d\x0a/dev/sda6 412307456 976771071 282231808 83 Linux\x0d\x0a \x0d\x0a 网卡\x0d\x0a 查看网卡硬件信息\x0d\x0a# lspci | grep -i 'eth'\x0d\x0a02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)\x0d\x0a \x0d\x0a 查看系统的所有网络接口\x0d\x0a# ifconfig -a\x0d\x0aeth0 Link encap:以太网 硬件地址 b8:97:5a:17:b3:8f \x0d\x0a .....\x0d\x0alo Link encap:本地环回 \x0d\x0a .....\x0d\x0a 或者是\x0d\x0aip link show\x0d\x0a1: lo: mtu 16436 qdisc noqueue state DOWN\x0d\x0alink/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\x0d\x0a2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000\x0d\x0alink/ether b8:97:5a:17:b3:8f brd ff:ff:ff:ff:ff:ff\x0d\x0a \x0d\x0a 如果要查看某个网络接口的详细信息,例如eth0的详细参数和指标\x0d\x0a# ethtool eth0\x0d\x0aSettings for eth0:\x0d\x0a Supported ports: [ TP MII ]\x0d\x0a Supported link modes: 10baseT/Half 10baseT/Full\x0d\x0a 100baseT/Half 100baseT/Full\x0d\x0a 1000baseT/Half 1000baseT/Full #支持千兆半双工,全双工模式\x0d\x0a Supported pause frame use: No\x0d\x0a Supports auto-negotiation: Yes #支持自适应模式,一般都支持\x0d\x0a Advertised link modes: 10baseT/Half 10baseT/Full\x0d\x0a 100baseT/Half 100baseT/Full\x0d\x0a 1000baseT/Half 1000baseT/Full\x0d\x0a Advertised pause frame use: Symmetric Receive-only\x0d\x0a Advertised auto-negotiation: Yes #默认使用自适应模式\x0d\x0a Link partner advertised link modes: 10baseT/Half 10baseT/Full\x0d\x0a 100baseT/Half 100baseT/Full\x0d\x0a .....\x0d\x0a Speed: 100Mb/s #现在网卡的速度是100Mb,网卡使用自适应模式,所以推测路由是100Mb,导致网卡从支 持千兆,变成要支持百兆\x0d\x0a Duplex: Full #全双工\x0d\x0a .....\x0d\x0a Link detected: yes #表示有网线连接,和路由是通的\x0d\x0a\x0d\x0a其他\x0d\x0a 查看pci信息,即主板所有硬件槽信息。\x0d\x0alspci\x0d\x0a00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09) #主板芯片\x0d\x0a00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) #显卡\x0d\x0a00:14.0 USB controller: Intel Corporation Panther Point USB xHCI Host Controller (rev 04) #usb控制器\x0d\x0a00:16.0 Communication controller: Intel Corporation Panther Point MEI Controller #1 (rev 04)\x0d\x0a00:1a.0 USB controller: Intel Corporation Panther Point USB Enhanced Host Controller #2 (rev 04)\x0d\x0a00:1b.0 Audio device: Intel Corporation Panther Point High Definition Audio Controller (rev 04) #声卡\x0d\x0a00:1c.0 PCI bridge: Intel Corporation Panther Point PCI Express Root Port 1 (rev c4) #pci 插槽\x0d\x0a00:1c.2 PCI bridge: Intel Corporation Panther Point PCI Express Root Port 3 (rev c4)\x0d\x0a00:1c.3 PCI bridge: Intel Corporation Panther Point PCI Express Root Port 4 (rev c4)\x0d\x0a00:1d.0 USB controller: Intel Corporation Panther Point USB Enhanced Host Controller #1 (rev 04)\x0d\x0a00:1f.0 ISA bridge: Intel Corporation Panther Point LPC Controller (rev 04)\x0d\x0a00:1f.2 IDE interface: Intel Corporation Panther Point 4 port SATA Controller [IDE mode] (rev 04) #硬盘接口\x0d\x0a00:1f.3 SMBus: Intel Corporation Panther Point SMBus Controller (rev 04)\x0d\x0a00:1f.5 IDE interface: Intel Corporation Panther Point 2 port SATA Controller [IDE mode] (rev 04) #硬盘接口\x0d\x0a02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06) #网卡\x0d\x0a03:00.0 PCI bridge: Integrated Technology Express, Inc. Device 8893 (rev 41)\x0d\x0a 如果要更详细的信息:lspci -v 或者 lspci -vv\x0d\x0a 如果要看设备树:lscpi -t\x0d\x0a \x0d\x0a 查看bios信息\x0d\x0a# dmidecode -t bios\x0d\x0a......\x0d\x0aBIOS Information\x0d\x0a Vendor: American Megatrends Inc.\x0d\x0a Version: 4.6.5\x0d\x0a Release Date: 04/25/2012\x0d\x0a .......\x0d\x0a BIOS Revision: 4.6\x0d\x0a......\x0d\x0a dmidecode以一种可读的方式dump出机器的DMI(Desktop Management Interface)信息。这些信息包括了硬件以及BIOS,既可以得到当前的配置,也可以得到系统支持的最大配置,比如说支持的最大内存数等。\x0d\x0a 如果要查看所有有用信息\x0d\x0a dmidecode -q\x0d\x0a 以上是linux查看硬件信息的所有命令,可以查看CPU、硬盘、网卡、磁盘等硬件的信息。
RHEL/CentOS/Fedora
在终端隐友中执行如下命令查看已安装的 Linux 内核:rpm -qa kernel或rpm -qa | grep -i kernel
Debian/Ubuntu/Linux Mint
要查看基于 DEB 系统的 Linux 内核列表,如:Debian、Ubuntu、Linux Mint、Elementary OS 等,可以使用如下命令:dpkg --list | grep linux-image
SUSE/openSUSE
在 SUSE 或 openSUSE 系统中,可以使用如下命令查看 Linux 系统袜携亩内核:rpm -qa | grep -i kernel
Arch Linux
Arch Linux 及其衍生发行版本,可以使用如下命《Linux就该这样学》令查告森看已安装的内核列表:pacman -Q linux或pacman -Q | grep linux
cpuinfo中描述行前嫌了一些CPU的信息,可以直接使用命令 cat /proc/cpuinfo 了解,其中几个字段是我档手们需要关注的,如下悔薯:
最后结合笔者笔记本截图来对以上进行印证: