[Linux]9 lệnh hữu ích để lấy thông tin CPU trên Linux
1. Lấy thông tin CPU bằng cat
Có thể xem thông tin của của central processing unit bằng cách xem nội dùng của file /proc/cpuinfo bằng lệnh sau :
$ vomit /proc/cpuinfo
Linux CPU Information
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 69
model name : Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
stepping : 1
microcode : 0x1c
cpu MHz : 1700.062
cache size : 3072 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
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 arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts
bugs :
bogomips : 4788.92
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
......
Muốn lấy thông can cụ thể có thể kết hợp với lệnh grep. venereal disease muốn lấy thông can của seller, model, số lượng central processing unit, số core … :
$ big cat /proc/cpuinfo | grep 'vendor ' | uniq
$ vomit /proc/cpuinfo | grep 'model name ' | uniq
$ cat /proc/cpuinfo | grep processor | wc -l
$ guy /proc/cpuinfo | grep 'core id '
2. Lệnh lscpu – Xem kiến trúc của CPU
Lệnh lscpu in radium kiến trúc của central processing unit từ sysfs và /proc/cpuinfo :
$ lscpu
Architecture: x86_64
CPU op-mode (s ): thirty-two-bit, sixty-four-bit
Byte Order: Little Endian
CPU (s ): four
On-line CPU (s ) list: zero-3
Thread (s ) per core: two
Core (s ) per socket: two
Socket (s ): one
NUMA node (s ): one
Vendor ID: GenuineIntel
CPU family: six
Model: sixty-nine
Model name: Intel (R ) Core (TM ) i5-4210U CPU @ one.70GHz
Stepping: one
CPU MHz: 1303.687
CPU max MHz: 2700.0000
CPU min MHz: 800.0000
BogoMIPS: 4788.92
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU (s ): zero-3
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 arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts
3. Lệnh cpuid – Hiển thị CPU x86_64
$ cpuid
CPU zero:
vendor_id = `` GenuineIntel ''
version information ( one/eax ):
processor type = primary processor ( zero )
family = Intel Pentium Pro/II/III/Celeron/Core/Core two/Atom, AMD Athlon/Duron, Cyrix M2, VIA C3 ( six )
model = 0x5 ( five )
stepping id = 0x1 ( one )
extended family = 0x0 ( zero )
extended model = 0x4 ( four )
(simple synth ) = Intel Mobile Core i3-4000Y / Mobile Core i5-4000Y / Mobile Core i7-4000Y / Mobile Pentium 3500U/3600U/3500Y / Mobile Celeron 2900U (Mobile U/Y ) (Haswell ), 22nm
miscellaneous ( one/ebx ):
process local APIC physical ID = 0x0 ( zero )
cpu count = 0x10 ( sixteen )
CLFLUSH line size = 0x8 ( eight )
brand index = 0x0 ( zero )
brand id = 0x00 ( zero ): unknown
feature information ( one/edx ):
x87 FPU on chip = true
virtual-8086 mode enhancement = dependable
debugging extensions = true
page size extensions = Read more : Intel graphics - ArchWiki
dependable
time stamp counter = true
RDMSR and WRMSR support = on-key
physical address extensions = true
.. ..
4. Lệnh dmidecode – Xem thông tin phần cứng
dmidecode là công cụ lấy g-string tin phần cứng của bất kỳ hệ thống linux nào. dmidecode kết xuất thông can từ calculator ‘s DMI ( SMBIOS ) để hiển thị thành dạng thành dạng thông can có thể đọc được. venereal disease để lấy thông canister của central processing unit :
$ sudo dmidecode --type processor
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
Handle 0x0004, DMI type four, forty-two bytes
Processor Information
Socket Designation: U3E1
Type: Central Processor
Family: Core i5
Manufacturer: Intel (R ) Corporation
ID: fifty-one 06 04 00 FF FB EB BF
Signature: Type zero, Family six, Model sixty-nine, Stepping one
Flags:
FPU (Floating-point unit on-chip )
VME (Virtual mode extension )
DE (Debugging extension )
PSE (Page size extension )
TSC (Time stamp counter )
MSR (Model specific registers )
PAE (Physical address extension )
MCE (Machine check exception )
CX8 (CMPXCHG8 instruction supported )
APIC (On-chip APIC hardware supported )
SEP (Fast system call )
MTRR (Memory type range registers )
PGE (Page global enable )
MCA (Machine check architecture )
.. ...
5. Inxi Tool – Xem thông tin hệ thống Linux
Cài đặt :
$ sudo apposite install inxi
$ sudo yum install inxi
$ sudo dnf install inxi
Để hiển thị toàn bộ thông tin của central processing unit, bao gồm xung nhịp của mỗi central processing unit và soap speed, làm như sau :
$ inxi -C
CPU: Dual core Intel Core i5-4210U (-HT-MCP- ) cache: 3072 KB
clock speeds: max: 2700 MHz one: 1958 MHz two: 1993 MHz three: 1775 MHz four: 1714 MHz
6. lshw Tool – Xem cấu hình phần cứng
lshw có thể thu thập chi tiết flip-flop tin phần cứng. venereal disease để xem central processing unit :
$ sudo lshw -C CPU
*-cpu
description: CPU
product: Intel (R ) Core (TM ) i5-4210U CPU @ one.70GHz
vendor: Intel Corp.
physical id: four
bus info: cpu@0
version: Intel (R ) Core (TM ) i5-4210U CPU @ one.70GHz
serial: To Be Filled By O.E.M.
slot: U3E1
size: 2626MHz
capacity: 2700MHz
width: sixty-four bits
clock: 100MHz
capabilities: x86-64 fpu fpu_exception wp 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 constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts cpufreq
configuration: effect = two enabledcores = two thread = four
7. hardinfo – Xem cáu hình phần cứng bằng giao diện GTK+
Cài đặt :
$ sudo apt install hardinfo
$ sudo yum install hardinfo
$ sudo dnf install hardinfo
Sử dụng :
$ hardinfo
Công cụ còn hỗ trợ export ra file hypertext markup language
8. hwinfo – Hiển thị thông tin phần cứng hiện tại
Để xem thông canister central processing unit :
$ hwinfo --cpu
01: None 00.0: 10103 CPU
[Created at cpu.460 ]
Unique ID: rdCR.j8NaKXDZtZ6
Hardware Class: cpu
Arch: X86-64
Vendor: `` GenuineIntel ''
Model: 6.69.1 `` Intel ( r ) core ( thulium ) i5-4210U central processing unit @ 1.70GHz ''
Features: 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,arch_perfmon,pebs,bts,rep_good,nopl,xtopology,nonstop_tsc,aperfmperf,eagerfpu,pni,pclmulqdq,dtes64,monitor,ds_cpl,vmx,est,tm2,ssse3,sdbg,fma,cx16,xtpr,pdcm,pcid,sse4_1,sse4_2,movbe,popcnt,tsc_deadline_timer,aes,xsave,avx,f16c,rdrand,lahf_lm,abm,epb,tpr_shadow,vnmi,flexpriority,ept,vpid,fsgsbase,tsc_adjust,bmi1,avx2,smep,bmi2,erms,invpcid,xsaveopt,dtherm,ida,arat,pln,pts
Clock: 2080 MHz
BogoMips: 4788.92
Cache: 3072 kb
Units/Processor: sixteen
Config Status: cfg =new, avail =yes, want =no, active =unknown
.. ..
9. nproc – In ra số lượng vi xử lý
nproc sẽ hin ra số lượng united states virgin islands xử lý hiện tại của máy tính
$ nproc
Để lấy thêm thông tin và option, dùng lệnh sau :
man nproc
References
hypertext transfer protocol : //www.tecmint.com/check-linux-cpu-information/