以我的笔记本为例,看看相关命令。
HP-NX6120,赛扬1.5G,2根内存条(1G + 512M),操作系统Ubuntu8.04。
查看Linux版本、内核
- ~$ cat /etc/issue
- Ubuntu 8.04.3 LTS \n \l
- ~$ cat /proc/version
- Linux version 2.6.24-26-generic (buildd@vernadsky) (gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu3))#1 SMP Tue Dec 1 18:37:31 UTC 2009
- ~$ uname -r
- 2.6.24-26-generic
查看CPU
在我的赛扬CPU笔记本上:
- ~$ cat /proc/cpuinfo
- processor : 0
- vendor_id : GenuineIntel
- cpu family : 6
- model : 13
- model name : Intel(R) Celeron(R) M processor 1.50GHz
- stepping : 8
- cpu MHz : 1499.869
- cache size : 1024 KB
- fdiv_bug : no
- hlt_bug : no
- f00f_bug : no
- coma_bug : no
- fpu : yes
- fpu_exception : yes
- cpuid level : 2
- wp : yes
- flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx up bts
- bogomips : 2999.73
- clflush size : 64
在一台PC服务器上(双U双核):
- ~$ cat /proc/cpuinfo
- processor : 0
- vendor_id : GenuineIntel
- cpu family : 6
- model : 15
- model name : Intel(R) Xeon(R) CPU 5130 @ 2.00GHz
- stepping : 6
- cpu MHz : 2000.070
- cache size : 4096 KB
- physical id : 0
- siblings : 2
- core id : 0
- cpu cores : 2
- fdiv_bug : no
- hlt_bug : no
- f00f_bug : no
- coma_bug : no
- fpu : yes
- fpu_exception : yes
- cpuid level : 10
- wp : yes
- flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm pni monitor ds_cpl tm2 xtpr
- bogomips : 4004.56
- processor : 1
- vendor_id : GenuineIntel
- cpu family : 6
- model : 15
- model name : Intel(R) Xeon(R) CPU 5130 @ 2.00GHz
- stepping : 6
- cpu MHz : 2000.070
- cache size : 4096 KB
- physical id : 0
- siblings : 2
- core id : 1
- cpu cores : 2
- fdiv_bug : no
- hlt_bug : no
- f00f_bug : no
- coma_bug : no
- fpu : yes
- fpu_exception : yes
- cpuid level : 10
- wp : yes
- flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm pni monitor ds_cpl tm2 xtpr
- bogomips : 4000.02
- processor : 2
- vendor_id : GenuineIntel
- cpu family : 6
- model : 15
- model name : Intel(R) Xeon(R) CPU 5130 @ 2.00GHz
- stepping : 6
- cpu MHz : 2000.070
- cache size : 4096 KB
- physical id : 3
- siblings : 2
- core id : 6
- cpu cores : 2
- fdiv_bug : no
- hlt_bug : no
- f00f_bug : no
- coma_bug : no
- fpu : yes
- fpu_exception : yes
- cpuid level : 10
- wp : yes
- flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm pni monitor ds_cpl tm2 xtpr
- bogomips : 4000.08
- processor : 3
- vendor_id : GenuineIntel
- cpu family : 6
- model : 15
- model name : Intel(R) Xeon(R) CPU 5130 @ 2.00GHz
- stepping : 6
- cpu MHz : 2000.070
- cache size : 4096 KB
- physical id : 3
- siblings : 2
- core id : 7
- cpu cores : 2
- fdiv_bug : no
- hlt_bug : no
- f00f_bug : no
- coma_bug : no
- fpu : yes
- fpu_exception : yes
- cpuid level : 10
- wp : yes
- flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm pni monitor ds_cpl tm2 xtpr
- bogomips : 4000.12
可以过滤一下:
- ~$ grep "model name" /proc/cpuinfo
- model name : Intel(R) Celeron(R) M processor 1.50GHz
多U多核的环境中查看CPU物理个数:
- ~$ cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
多U多核的环境中查看CPU核数:
- ~$ cat /proc/cpuinfo | grep "cores" | uniq
查看内存
- ~$ cat /proc/meminfo
- MemTotal: 1547292 kB
- MemFree: 82216 kB
- Buffers: 74720 kB
- Cached: 895940 kB
- SwapCached: 0 kB
- Active: 712544 kB
- Inactive: 599772 kB
- HighTotal: 646976 kB
- HighFree: 1116 kB
- LowTotal: 900316 kB
- LowFree: 81100 kB
- SwapTotal: 979924 kB
- SwapFree: 979924 kB
- Dirty: 84 kB
- Writeback: 0 kB
- AnonPages: 341708 kB
- Mapped: 83216 kB
- Slab: 80324 kB
- SReclaimable: 67092 kB
- SUnreclaim: 13232 kB
- PageTables: 2936 kB
- NFS_Unstable: 0 kB
- Bounce: 0 kB
- CommitLimit: 1753568 kB
- Committed_AS: 886988 kB
- VmallocTotal: 114680 kB
- VmallocUsed: 6852 kB
- VmallocChunk: 107508 kB
可以过滤一下:
- ~$ grep MemTotal /proc/meminfo
- MemTotal: 1547292 kB
查看系统位数
当前的Linux计算机,基本上就是32位或64位之分,可以通过查看long整形的位数确定,看看是32位还是64位:
- ~$ getconf LONG_BIT
- 32