使用linux命令查看cpu

fiy 其他 60

回复

共3条回复 我来回复
  • fiy的头像
    fiy
    Worktile&PingCode市场小伙伴
    评论

    要使用Linux命令查看CPU信息,可以使用以下几个命令:

    1. `lscpu`
    这个命令可以显示CPU的详细信息,包括每个CPU的型号、制造商、核心数量、线程数量、缓存大小等等。示例如下:
    “`
    $ lscpu
    Architecture: x86_64
    CPU op-mode(s): 32-bit, 64-bit
    Byte Order: Little Endian
    CPU(s): 8
    On-line CPU(s) list: 0-7
    Thread(s) per core: 2
    Core(s) per socket: 4
    Socket(s): 1
    NUMA node(s): 1
    Vendor ID: GenuineIntel
    CPU family: 6
    Model: 158
    Model name: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Stepping: 9
    CPU MHz: 900.187
    CPU max MHz: 3800.0000
    CPU min MHz: 800.0000
    BogoMIPS: 5616.00
    Virtualization: VT-x
    L1d cache: 32K
    L1i cache: 32K
    L2 cache: 256K
    L3 cache: 6144K
    NUMA node0 CPU(s): 0-7
    “`

    2. `cat /proc/cpuinfo`
    这个命令会以纯文本的形式显示CPU信息。示例如下:
    “`
    $ cat /proc/cpuinfo
    processor : 0
    vendor_id : GenuineIntel
    cpu family : 6
    model : 158
    model name : Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    stepping : 9
    microcode : 0xde
    cpu MHz : 900.084
    cache size : 6144 KB
    physical id : 0
    siblings : 8
    core id : 0
    cpu cores : 4
    apicid : 0
    initial apicid : 0
    fpu : yes
    fpu_exception : yes
    cpuid level : 22
    wp : yes
    flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts md_clear flush_l1d
    bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit srbds
    bogomips : 5616.00
    clflush size : 64
    cache_alignment : 64
    address sizes : 39 bits physical, 48 bits virtual
    power management:

    “`

    3. `top`
    `top`命令用于实时监视系统的运行状况,包括CPU的使用情况。在`top`命令的输出中,CPU信息通常会显示在最顶部。示例如下:
    “`
    top – 15:14:49 up 60 days, 3:12, 1 user, load average: 0.10, 0.06, 0.02
    Tasks: 218 total, 1 running, 217 sleeping, 0 stopped, 0 zombie
    %Cpu(s): 2.0 us, 0.8 sy, 0.0 ni, 96.9 id, 0.2 wa, 0.0 hi, 0.1 si, 0.0 st
    KiB Mem : 16353812 total, 1708268 free, 6996000 used, 7659560 buff/cache
    KiB Swap: 0 total, 0 free, 0 used. 7930512 avail Mem

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    2117 root 20 0 726040 98504 94840 S 22.5 0.6 2060:10 Xorg
    2494 user 20 0 3410128 432420 93160 S 20.2 2.6 529:42.19 gnome-shell

    “`

    这三个命令可以帮助你快速查看Linux系统中的CPU信息,并了解CPU的型号、频率、核心数量等重要信息。

    2年前 0条评论
  • 不及物动词的头像
    不及物动词
    这个人很懒,什么都没有留下~
    评论

    要查看 CPU 的信息,可以使用以下命令:

    1. `cat /proc/cpuinfo`:显示关于 CPU 的详细信息,包括型号、频率、核心数量等。

    2. `lscpu`:显示更简洁的 CPU 信息,提供了更容易阅读的输出格式。

    3. `top`:显示系统的实时状态,包括 CPU 使用率、进程信息等,按下键盘上的 `1` 可以显示每个 CPU 核心的使用情况。

    4. `mpstat`:显示多个处理器的详细信息,包括每个 CPU 核心的使用率、平均负载等。

    5. `htop`:类似于 `top` 命令,但提供更友好的界面和交互功能。可以直观地查看 CPU 使用情况以及其他系统的性能指标。

    这些命令都可以在终端中直接运行,通过查看输出结果可以获取 CPU 的详细信息,包括核心数量、型号、频率、缓存大小、架构等。

    2年前 0条评论
  • worktile的头像
    worktile
    Worktile官方账号
    评论

    在Linux系统中,可以使用多个命令来查看CPU信息,这里我将介绍三个常用的命令:top、lscpu和cat /proc/cpuinfo。

    1. 使用top命令查看CPU信息
    top命令是一个动态实时监视进程活动的命令行程序。它可以显示系统中CPU的使用情况、进程的信息以及其他系统统计数据。打开终端窗口,输入top命令并按下回车键,将会显示类似下面的信息:

    “`
    top – 17:33:44 up 1 day, 3:27, 2 users, load average: 0.03, 0.00, 0.00
    Tasks: 234 total, 1 running, 233 sleeping, 0 stopped, 0 zombie
    %Cpu(s): 0.3 us, 1.0 sy, 0.0 ni, 98.6 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
    KiB Mem : 8069068 total, 2466568 free, 3091800 used, 2510700 buff/cache
    KiB Swap: 2097148 total, 2097148 free, 0 used. 4390140 avail Mem

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    32643 user 20 0 5126232 250256 73196 S 3.6 3.1 8:18.25 gnome-shell
    17135 user 20 0 3889904 245752 51444 S 1.7 3.0 3:15.31 mysql
    13008 root 20 0 1140100 66176 22868 S 0.7 0.8 3:28.83 Xorg
    17584 user 20 0 4394648 257020 62512 S 0.7 3.2 5:30.34 firefox
    20768 user 20 0 25964 2124 1572 R 0.7 0.0 0:00.03 top
    17 root 20 0 0 0 0 S 0.3 0.0 1:26.07 rcuos/5
    “`

    在这个输出中,%Cpu(s)这一行显示了CPU的使用情况,包括用户空间使用(%us)、系统内核空间使用(%sy)、等待输入/输出的CPU时间(%wa)等信息。通过这些信息,可以了解CPU在系统中的使用情况。

    2. 使用lscpu命令查看CPU信息
    lscpu命令用于显示CPU架构的信息,包括CPU的型号、核心数量、线程数等。打开终端窗口,输入lscpu命令并按下回车键,将会显示类似下面的信息:

    “`
    Architecture: x86_64
    CPU op-mode(s): 32-bit, 64-bit
    Byte Order: Little Endian
    CPU(s): 8
    On-line CPU(s) list: 0-7
    Thread(s) per core: 2
    Core(s) per socket: 4
    Socket(s): 1
    NUMA node(s): 1
    Vendor ID: GenuineIntel
    CPU family: 6
    Model: 158
    Model name: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Stepping: 10
    CPU MHz: 4000.000
    BogoMIPS: 4787.20
    Virtualization: VT-x
    L1d cache: 32K
    L1i cache: 32K
    L2 cache: 256K
    L3 cache: 8192K
    NUMA node0 CPU(s): 0-7
    “`

    在这个输出中,CPU(s)表示CPU的总数,Thread(s) per core表示每个核心的线程数,Core(s) per socket表示每个物理CPU插槽的核心数,Model name表示CPU的型号。

    3. 使用cat /proc/cpuinfo命令查看CPU信息
    在Linux系统中,/proc/cpuinfo是一个特殊的文件,保存了当前系统中所有的CPU信息。可以使用cat命令查看该文件内容。打开终端窗口,输入cat /proc/cpuinfo命令并按下回车键,将会显示类似下面的信息:

    “`
    processor : 0
    vendor_id : GenuineIntel
    cpu family : 6
    model : 158
    model name : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    stepping : 10
    microcode : 0xd6
    cpu MHz : 4000.545
    cache size : 8192 KB
    physical id : 0
    siblings : 8
    core id : 0
    cpu cores : 4
    apicid : 0
    initial apicid : 0
    fpu : yes
    fpu_exception : yes
    cpuid level : 22
    wp : yes
    flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
    bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds
    bogomips : 4787.20
    clflush size : 64
    cache_alignment : 64
    address sizes : 39 bits physical, 48 bits virtual
    power management:
    “`

    这个输出中包含了每个CPU核心的详细信息,包括厂商ID、CPU系列、型号、型号名称、主频、缓存大小等。

    综上所述,使用top、lscpu和cat /proc/cpuinfo命令可以在Linux系统中查看CPU信息,以便了解CPU的使用情况、型号等。

    2年前 0条评论
注册PingCode 在线客服
站长微信
站长微信
电话联系

400-800-1024

工作日9:30-21:00在线

分享本页
返回顶部