Thursday, May 15, 2008

Linux Basics - part 1

How to check CPU and RAM information on a Linux system?

# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 4
model name : Intel(R) Pentium(R) 4 CPU 3.60GHz
stepping : 3
cpu MHz : 3600.276
cache size : 2048 KB
physical id : 0
siblings : 2
runqueue : 0
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 pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm nx lm
bogomips : 7182.74

processor : 1
vendor_id : GenuineIntel
cpu family : 15
model : 4
model name : Intel(R) Pentium(R) 4 CPU 3.60GHz
stepping : 3
cpu MHz : 3600.276
cache size : 2048 KB
physical id : 0
siblings : 2
runqueue : 0
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 pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm nx lm
bogomips : 7182.74


# free
total used free shared buffers cached
Mem: 1025188 993024 32164 0 139796 174216
-/+ buffers/cache: 679012 346176
Swap: 2040244 253152 1787092

# top
13:23:44 up 6 days, 1:32, 4 users, load average: 0.00, 0.00, 0.00
254 processes: 252 sleeping, 1 running, 1 zombie, 0 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 99.9%
cpu00 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 100.0%
cpu01 0.0% 0.0% 0.2% 0.0% 0.0% 0.0% 99.8%
Mem: 1025188k av, 993024k used, 32164k free, 0k shrd, 139860k buff
608360k actv, 113132k in_d, 11116k in_c
Swap: 2040244k av, 253152k used, 1787092k free 174264k cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
1 root 15 0 488 452 428 S 0.0 0.0 0:06 0 init
2 root RT 0 0 0 0 SW 0.0 0.0 0:00 0 migration/0
3 root RT 0 0 0 0 SW 0.0 0.0 0:00 1 migration/1
4 root 15 0 0 0 0 SW 0.0 0.0 0:00 1 keventd
5 root 34 19 0 0 0 SWN 0.0 0.0 0:00 0 ksoftirqd/0
6 root 34 19 0 0 0 SWN 0.0 0.0 0:00 1 ksoftirqd/1
9 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 bdflush
7 root 15 0 0 0 0 SW 0.0 0.0 1:02 1 kswapd
8 root 15 0 0 0 0 SW 0.0 0.0 0:47 0 kscand
10 root 15 0 0 0 0 SW 0.0 0.0 0:03 0 kupdated


# free -m
total used free shared buffers cached
Mem: 1001 969 31 0 136 170
-/+ buffers/cache: 662 338
Swap: 1992 247 1745



# cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 1049792512 1016717312 33075200 0 143220736 201736192
Swap: 2089209856 259227648 1829982208
MemTotal: 1025188 kB
MemFree: 32300 kB
MemShared: 0 kB
Buffers: 139864 kB
Cached: 174264 kB
SwapCached: 22744 kB
Active: 607972 kB
ActiveAnon: 432296 kB
ActiveCache: 175676 kB
Inact_dirty: 113132 kB
Inact_laundry: 23008 kB
Inact_clean: 11116 kB
Inact_target: 151044 kB
HighTotal: 130816 kB
HighFree: 3868 kB
LowTotal: 894372 kB
LowFree: 28432 kB
SwapTotal: 2040244 kB
SwapFree: 1787092 kB
CommitLimit: 2552836 kB
Committed_AS: 2622300 kB
HugePages_Total: 0
HugePages_Free: 0
Hugepagesize: 2048 kB

# cat /proc/cpuinfo egrep 'processor|vendor_id|cpu MHz|model name'
processor : 0
vendor_id : GenuineIntel
model name : Intel(R) Pentium(R) 4 CPU 3.80GHz
cpu MHz : 3800.307
processor : 1
vendor_id : GenuineIntel
model name : Intel(R) Pentium(R) 4 CPU 3.80GHz
cpu MHz : 3800.307

No comments: