Linux查看CPU、内存参数及系统版本信息常用命令
<div><p><strong>1、查看物理CPU的个数</strong><br>
#cat /proc/cpuinfo |grep “physical id”|sort |uniq|wc –l</p>
<p><strong>2、查看逻辑CPU的个数</strong><br>
#cat /proc/cpuinfo |grep “processor”|wc –l</p>
<p><strong>3、查看CPU是几核</strong><br>
#cat /proc/cpuinfo |grep “cores”|uniq</p>
<p><strong>4、查看CPU的主频</strong><br>
#cat /proc/cpuinfo |grep MHz|uniq</p>
<p><strong>5、查看当前操作系统内核信息</strong></p>
<p># uname -a</p>
<p>Linux euis1 2.6.9-55.ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686 i686 i386 GNU/Linux</p>
<p><strong>6、查看当前操作系统发行版信息</strong></p>
<p># cat /etc/issue | grep Linux</p>
<p>Red Hat Enterprise Linux AS release 4 (Nahant Update 5()</p>
<p><strong>7、查看CPU型号</strong></p>
<p># cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c</p>
<p>Intel(R) Xeon(R) CPU E5410 @ 2.33GHz</p>
<p><strong>8、查看CPU数量及核数,看到这个说明实际上是两颗4核的CPU</strong></p>
<p># cat /proc/cpuinfo | grep physical | uniq -c</p>
<p>4 physical id : 0</p>
<p>4 physical id : 1</p>
<p><strong>9、查看当前CPU运行位数,当前说明CPU在32bit模式下, 但不代表CPU不支持64bit</strong></p>
<p># getconf LONG_BIT</p>
<p>32</p>
<p><strong>10、结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit</strong></p>
<p># cat /proc/cpuinfo | grep flags | grep ‘ lm ‘ | wc –l</p>
<p>8</p>
<p><strong>11、获得CPU的详细信息</strong></p>
<p># cat /proc/cpuinfo</p>
<p><strong>12、用命令判断几个物理CPU,几个核等</strong></p>
<p>逻辑CPU个数:<br>
# cat /proc/cpuinfo | grep “processor” | wc -l</p>
<p>物理CPU个数:<br>
# cat /proc/cpuinfo | grep “physical id” | sort | uniq | wc -l</p>
<p><strong>13、每个物理CPU中Core的个数:</strong></p>
<p># cat /proc/cpuinfo | grep “cpu cores” | wc -l</p>
<p><strong>14、是否为超线程?如果有两个逻辑CPU具有相同的”core id”,那么超线程是打开的,每个物理CPU中逻辑CPU(可能是core, threads或both)的个数</strong></p>
<p># cat /proc/cpuinfo | grep “siblings”</p>
<p><strong>15、查看内存信息命令</strong></p>
<p>cat /proc/meminfo</p>
<p><strong>16、查看硬盘信息命令</strong></p>
<p>fdisk -l</p>
<p><strong>17、查看当前操作系统发行版信息</strong></p>
<div># cat /etc/issue | grep Linux</div>
<div>Red Hat Enterprise Linux AS release 4 (Nahant Update 5)</div>
</div>
<div></div>
<div><strong>18、查看机器型号 </strong></div>
<div>
<p># dmidecode | grep “Product Name”</p>
<p><strong>19、查看网卡信息 </strong></p>
<p># dmesg | grep -i eth</p>
<p><strong>20、查看操作系统版本</strong></p>
<p># lsb_release -a</p>
</div>
<div></div>
<div><strong>测试机的硬件信息: </strong></div>
<div></div>
<div>查看CPU信息(型号)</div>
<div># cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c</div>
<div> 8 Intel(R) Xeon(R) CPU E5410 @ 2.33GHz</div>
<div>(看到有8个逻辑CPU, 也知道了CPU型号)</div>
<div></div>
<div># cat /proc/cpuinfo | grep physical | uniq -c</div>
<div> 4 physical id : 0</div>
<div> 4 physical id : 1</div>
<div>(说明实际上是两颗4核的CPU)</div>
<div></div>
<div># getconf LONG_BIT</div>
<div> 32</div>
<div>(说明当前CPU运行在32bit模式下, 但不代表CPU不支持64bit)</div>
<div></div>
<div># cat /proc/cpuinfo | grep flags | grep ‘ lm ‘ | wc -l</div>
<div> 8</div>
<div>(结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit)</div>
<div></div>
<div>再完整看cpu详细信息, 不过大部分我们都不关心而已.</div>
<div># dmidecode | grep ‘Processor Information’</div>
<div></div>
<div>查看内存信息</div>
<div># cat /proc/meminfo</div>
<div></div>
<p class="post-copyright">未经允许不得转载:<ahref="https://www.wangchao.info/">王超博客</a> » <ahref="https://www.wangchao.info/1155.html">Linux查看CPU、内存参数及系统版本信息常用命令</a></p>
页:
[1]