1. view the production system version
# Uname-
Linux applications-test-game 2.6.9-11. elsmp #1 SMP Fri May 20 18:26:27 EDT 2005 i686 i68
6 i386 GNU/Linux
# Cat/proc/version
Linux version 2.6.9-11. elsmp (bhcompile@decompose.build.redhat.com) (GCC version
3.4.3 20050227 (Red Hat 3.4.3-22) #1 SMP Fri May 20 18:26:27 EDT 2005
# Cat/etc/issue
Red Hat Enterprise Linux as Release 4 (nahant update 1)
Kernel R on an M
# Cat/etc/RedHat-release
Red Hat Enterprise Linux as Release 4 (nahant update 1)
Ii. View CPU
The CPU information in Linux is stored in the/proc/cpuinfo file. This file contains a large number of messages, you can use fopen to open it or use popen to execute a cat command to get the result.
# Cat/proc/cpuinfo
Processor: 0
Vendor_id: genuineintel
CPU family: 15
Model: 4
Model name: Intel (r) Xeon (TM) CPU 3.20 GHz
Stepping: 10
CPU MHz: 3200.847
Cache size: 2048 KB
Physical ID: 0
Siblings: 2
Fdiv_bug: No
Hlt_bug: No
F00f_bug: No
Coma_bug: No
FPU: Yes
Fpu_exception: Yes
Cpuid level: 5
WP: Yes
Flags: fpu vme de pse tsc msr pae mce cx8 APIC Sep mtrr pge mca cmov
Pat limit 36 clflush dts acpi mmx fxsr SSE sse2 ss ht tm pbe nx lm PNI monitor ds_c
Pl cid xtpr
Bogomips: 6275.07
Processor: 1
Vendor_id: genuineintel
CPU family: 15
Model: 4
Model name: Intel (r) Xeon (TM) CPU 3.20 GHz
Stepping: 10
CPU MHz: 3200.847
Cache size: 2048 KB
Physical ID: 0
Siblings: 2
Fdiv_bug: No
Hlt_bug: No
F00f_bug: No
Coma_bug: No
FPU: Yes
Fpu_exception: Yes
Cpuid level: 5
WP: Yes
Flags: fpu vme de pse tsc msr pae mce cx8 APIC Sep mtrr pge mca cmov
Pat limit 36 clflush dts acpi mmx fxsr SSE sse2 ss ht tm pbe nx lm PNI monitor ds_c
Pl cid xtpr
Bogomips: 6389.76
Processor: 2
Vendor_id: genuineintel
CPU family: 15
Model: 4
Model name: Intel (r) Xeon (TM) CPU 3.20 GHz
Stepping: 10
CPU MHz: 3200.847
Cache size: 2048 KB
Physical ID: 3
Siblings: 2
Fdiv_bug: No
Hlt_bug: No
F00f_bug: No
Coma_bug: No
FPU: Yes
Fpu_exception: Yes
Cpuid level: 5
WP: Yes
Flags: fpu vme de pse tsc msr pae mce cx8 APIC Sep mtrr pge mca cmov
Pat limit 36 clflush dts acpi mmx fxsr SSE sse2 ss ht tm pbe nx lm PNI monitor ds_c
Pl cid xtpr
Bogomips: 6389.76
Processor: 3
Vendor_id: genuineintel
CPU family: 15
Model: 4
Model name: Intel (r) Xeon (TM) CPU 3.20 GHz
Stepping: 10
CPU MHz: 3200.847
Cache size: 2048 KB
Physical ID: 3
Siblings: 2
Fdiv_bug: No
Hlt_bug: No
F00f_bug: No
Coma_bug: No
FPU: Yes
Fpu_exception: Yes
Cpuid level: 5
WP: Yes
Flags: fpu vme de pse tsc msr pae mce cx8 APIC Sep mtrr pge mca cmov
Pat limit 36 clflush dts acpi mmx fxsr SSE sse2 ss ht tm pbe nx lm PNI monitor ds_c
Pl cid xtpr
Bogomips: 6389.76
The complete information of the CPU.
# Cat/proc/cpuinfo | grep processor | WC-l
4
CPU count, which has four CPUs (maybe two cores ).
3. view the internal memory information
Similar to the CPU, the memory information in Linux is stored in the/proc/meminfo file, which contains a lot of memory information, you can use fopen to open it or use popen to execute a cat command to get the result.
For example:
# Free
Total used free shared buffers cached
Mem: 1034148 846312 187836 0 57304 418236
-/+ Buffers/cache: 370772 663376
Swap: 2031608 0 2031608
Or:
# Cat/proc/meminfo
Memtotal: 1034148 KB
Memfree: 188620 KB
Buffers': 57312 KB
Cached: 418228 KB
Swapcached: 0 KB
Active: 559084 KB
Inactive: 226244 KB
Hightotal: 130496 KB
Highfree: 252 KB
Lowtotal: 903652 KB
Lowfree: 188368 KB
Swaptotal: 2031608 KB
Swapfree: 2031608 KB
Dirty: 60 KB
Writeback: 0 KB
Mapped: 364944 KB
Slab: 49184 KB
Committed_as: 487816 KB
Pagetables: 2832 KB
Vmalloctotal: 106488 KB
Vmallocused: 3504 KB
Vmallocchunk: 102648 KB
Hugepages_total: 0
Hugepages_free: 0
Hugepagesize: 2048 KB