Sunday, August 17, 2008

Exploring the proc diretory on Linux

The /proc directory on ubuntu ( or any other linux ) is an interesting place to look at. See this listing.

sunil@debian:~$ ls /proc
1 2043 23019 31945 6893 devices key-users swaps
10 2234 2426 32039 6894 diskstats kmsg sys
10003 2239 2471 4 693 dma loadavg sysrq-trigger
101 2240 24877 5 7014 driver locks sysvipc
1135 2246 24878 591 705 execdomains meminfo tty
1292 2247 2508 5934 885 fb misc uptime
13872 2248 2509 6 9 filesystems modules version
13923 2249 2510 609 969 fs mounts vmstat
142 2250 2511 611 acpi ide mtrr zoneinfo
143 2254 2512 6857 asound interrupts net
1492 2255 2515 6858 buddyinfo iomem partitions
1510 2258 27933 6859 bus ioports scsi
1771 2261 27970 6860 cmdline irq self
2 22998 27971 6876 cpuinfo kallsyms slabinfo
2037 22999 3 6891 crypto kcore stat

This directory is not residing on your hard disk. Instead it is a snapshot of things inside your kernel. You can see a lot of numbers in the listing above. These refer to various processes running on the system. There are several files you can peek at in /proc . Look at cpuinfo.

sunil@debian:/proc/6891$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 4
model name : Intel(R) Celeron(R) CPU 2.66GHz
stepping : 9
cpu MHz : 2660.155
cache size : 256 KB
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 pbe nx lm constant_tsc up pni monitor ds_cpl tm2 cid cx16 xtpr lahf_lm
bogomips : 5325.03

This file give you all the information the currently running kernel has , about your processor.
You can explore the rest of the files to find out a lot of system and network related information.

No comments: