In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
How to get CPU information in Linux? In response to this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more small partners who want to solve this problem find a simpler and easier way.
Method 1: Check the/proc/cpuinfo file for CPU information
By displaying the contents of the/proc/cpuinfo virtual file, it is the easiest way to determine information such as CPU type. Using the proc/cpuinfo file to identify the processor type does not require any additional programs to be installed. No matter what Linux distribution we use, it works.
Open the terminal and use less or cat to display the contents of/proc/cpuinfo so we can get and view CPU information:
less /proc/cpuinfo
This command displays each logical CPU with an identification number. For example, if the computer has 8 core processors, we will see a list of all cores starting from 0 to 7. Here is an example of output:
processor : 0vendor_id : GenuineIntelcpu family : 6model : 142model name : Intel(R) Core(TM) i5-8250U CPU @ 1.60GHzstepping : 10microcode : 0x96cpu MHz : 700.120cache size : 6144 KBphysical id : 0siblings : 8core id : 0cpu cores : 4apicid : 0initial apicid : 0fpu : yesfpu_exception : yescpuid level : 22wp : yesflags : 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 pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1dbugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tfbogomips : 3600.00clflush size : 64cache_alignment : 64address sizes : 39 bits physical, 48 bits virtualpower management:...
Here are some of the important lines:
Processor: Unique identification number for each processor, starting with 0.
Model name: The full name of the processor, including the processor brand. Once we know the exact type of CPU we have, we can look at the product documentation for processor specifications.
flags: CPU functions.
If you don't want to display so much information, you can filter the output using grep. For example:
To display only the processor names that will be used:
grep -m 1 'model name' /proc/cpuinfo
Output:
model name: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
To print CPU count:
grep -c 'model name' /proc/cpuinfo
output
8
Knowing the number of CPUs can be handy when compiling software from source code and wanting to know how many parallel processes can execute simultaneously. Another way to find the CPU count is to use the following nproc command:
nproc
output
8
Method 2: Use lscpu to get CPU information
lscpu is a command-line utility that displays information about CPU architecture. lscpu is part of the util-linux package, which is installed on all Linux distributions.
At the shell prompt, type lscpu:
lscpu
The output will be as follows, including information about CPU count, architecture, vendor, family, model, speed, cache, flags, etc.
Architecture: x86_64CPU op-mode(s): 32-bit, 64-bitByte Order: Little EndianCPU(s): 8On-line CPU(s) list: 0-7Thread(s) per core: 2Core(s) per socket: 4Socket(s): 1NUMA node(s): 1Vendor ID: GenuineIntelCPU family: 6Model: 142Model name: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHzStepping: 10CPU MHz: 593.577CPU max MHz: 3400.0000CPU min MHz: 400.0000BogoMIPS: 3600.00Virtualization: VT-xL1d cache: 32KL1i cache: 32KL2 cache: 256KL3 cache: 6144KNUMA node0 CPU(s): 0-7Flags: 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 pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d
Note: Unlike the contents of the/proc/cpuinfo file, the output of lscpu does not display a list of all logical CPUs.
How to get CPU information in Linux? The answer to the question is shared here. I hope the above content can be helpful to everyone. If you still have a lot of doubts, you can pay attention to the industry information channel to learn more about it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.