close

Cách xem thông số cpu trên VPS linux

Tác giả: Nguyen Văn Phong Ngày cập nhật: 15/09/2019 Chuyên mục:
Disclosure
Website Wiki.tino.org được cung cấp bởi Tino Group. Truy cập và sử dụng website đồng nghĩa với việc bạn đồng ý với các điều khoản và điều kiện trong chính sách bảo mật - điều khoản sử dụng nội dung. Wiki.tino.org có thể thay đổi điều khoản sử dụng bất cứ lúc nào. Việc bạn tiếp tục sử dụng Wiki.tino.org sau khi thay đổi có nghĩa là bạn chấp nhận những thay đổi đó.
Why Trust Us
Các bài viết với hàm lượng tri thức cao tại wiki.tino.org được tạo ra bởi các chuyên viên Marketing vững chuyên môn và được kiểm duyệt nghiêm túc theo chính sách biên tập bởi đội ngũ biên tập viên dày dặn kinh nghiệm. Mọi nỗ lực của chúng tôi đều hướng đến mong muốn mang đến cho cộng đồng nguồn thông tin chất lượng, chính xác, khách quan, đồng thời tuân thủ các tiêu chuẩn cao nhất trong báo cáo và xuất bản.

1. Lấy thông tin CPU bằng thư viện cpuinfo

Có thể xem thông tin của của CPU bằng cách xem nội dung của file /proc/cpuinfo bằng lệnh sau:

$ cat /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 tin cụ thể có thể kết hợp với lệnh grep. Vd muốn lấy thông tin của vendor, model, số lượng cpu, số core…:

$ cat /proc/cpuinfo | grep 'vendor' | uniq		# Hiển thị nhà cung cấp
$ cat /proc/cpuinfo | grep 'model name' | uniq		# Hiển thị model CPU
$ cat /proc/cpuinfo | grep processor | wc -l		# Hiển thị số lượng core CPU.

 

 

2. Lệnh cpuid

Cài đặt trên centos:

yum install cpuid -y

apt-get install cpuid 

$ cpuid
CPU 0:
vendor_id = "GenuineIntel"
version information (1/eax):
processor type  = primary processor (0)
family          = Intel Pentium Pro/II/III/Celeron/Core/Core 2/Atom, AMD Athlon/Duron, Cyrix M2, VIA C3 (6)
model           = 0x5 (5)
stepping id     = 0x1 (1)
extended family = 0x0 (0)
extended model  = 0x4 (4)
(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 (1/ebx):
process local APIC physical ID = 0x0 (0)
cpu count                      = 0x10 (16)
CLFLUSH line size              = 0x8 (8)
brand index                    = 0x0 (0)
brand id = 0x00 (0): unknown
feature information (1/edx):
x87 FPU on chip                        = true
virtual-8086 mode enhancement          = true
debugging extensions                   = true
page size extensions                   = true
time stamp counter                     = true
RDMSR and WRMSR support                = true
physical address extensions            = true
....

3. Lệnh dmidecode – Xem thông tin phần cứng

dmidecode là công cụ lấy thong tin phần cứng của bất kỳ hệ thống Linux nào. dmidecode kết xuất thông tin từ computer’s DMI (SMBIOS) để hiển thị thành dạng thành dạng thông tin có thể đọc được. Vd để lấy thông tin của CPU :

$ sudo dmidecode --type processor
Getting SMBIOS data from sysfs.
SMBIOS 2.8 present.

Handle 0x0400, DMI type 4, 42 bytes
Processor Information
Socket Designation: CPU 0
Type: Central Processor
Family: Other
Manufacturer: QEMU
ID: 54 06 05 00 FF FB 8B 07
Version: pc-i440fx-3.1
Voltage: Unknown
External Clock: Unknown
Max Speed: 2000 MHz
Current Speed: 2000 MHz
Status: Populated, Enabled
Upgrade: Other
L1 Cache Handle: Not Provided
L2 Cache Handle: Not Provided
L3 Cache Handle: Not Provided
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 1
Core Enabled: 1
Thread Count: 1
Characteristics: None

 

4. Inxi Tool – Xem thông tin hệ thống Linux

Cài đặt:

$ sudo apt install inxi 	#Debian/Ubuntu systems
$ sudo yum install inxi		#RHEL/CentOS systems 
$ sudo dnf install inxi		#Fedora 22+ 

Để hiển thị toàn bộ thông tin của CPU, bao gồm xung nhịp của mỗi CPU và max speed, làm như sau:

$ inxi -C
CPU:       Dual core Intel Core i5-4210U (-HT-MCP-) cache: 3072 KB 
clock speeds: max: 2700 MHz 1: 1958 MHz 2: 1993 MHz 3: 1775 MHz 4: 1714 MHz

5. lshw Tool – Xem cấu hình phần cứng

lshw có thể thu thập chi tiết thong tin phần cứng. Vd để xem CPU:

$ sudo lshw -C CPU
  *-cpu                     
       description: CPU
       product: Virtual CPU 82d9ed4018dd
       vendor: Intel Corp.
       vendor_id: GenuineIntel
       physical id: 400
       bus info: cpu@0
       version: pc-i440fx-3.1
       slot: CPU 0
       size: 2GHz
       capacity: 2GHz
       width: 64 bits
       capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx pdpe1gb rdtscp x86-64 constant_tsc rep_good nopl xtopology eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm avx512f avx512dq clwb avx512cd avx512bw avx512vl xsaveopt arat
       configuration: cores=1 enabledcores=1 threads=1

 

6. hwinfo – Hiển thị thông tin phần cứng hiện tại

  • Cài đặt cho SUSE:
yast -i hwinfo
  • đối với Debian, Ubuntu, Kubuntu, Flubuntu, Xubuntu, GEUbuntu, Edubuntu, …:
apt-get install hwinfo
  • cài đặt cho Fedora, Red Hat, Red Flag, Asianux, …:
yum install hwinfo -y

Để xem thông tin CPU:

$ 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(TM) i5-4210U CPU @ 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: 16
Config Status: cfg=new, avail=yes, need=no, active=unknown
....

7. nproc – In ra số lượng vi xử lý

nproc sẽ hin ra số lượng vi xử lý hiện tại của máy tính

$ nproc

Để lấy thêm thông tin và options, dùng lệnh sau:

man nproc

 

Bài viết liên quan

CÔNG TY CỔ PHẦN TẬP ĐOÀN TINO
Trụ sở chính: L17-11, Tầng 17, Tòa nhà Vincom Center, Số 72 Lê Thánh Tôn,  Phường Bến Nghé, Q. 1, TP. Hồ Chí Minh

Văn phòng kinh doanh: Số 42 Trần Phú, Phường 4, Quận 5, TP HCM
GPKD số 0315679836 do Sở KH và ĐT TP Hồ Chí Minh cấp
Hotline: 0364 333 333
Góp ý/Phản ánh dịch vụ: 0933 000 886