Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-25-2005, 01:29 PM   #1
Registered: Jun 2005
Distribution: OpenSUSE 10.3 , 11.2 , Solaris 10, Ubuntu 9.10
Posts: 84

Rep: Reputation: 16
Exclamation System Information Made Easy : Contains of /proc directory in details

"Even LINUX Experts discovers new tricks!"

Dear Forum members ,

Have you ever wandered how the "KDE System Guard ", "top" etc. actually works ? How it gets all the details information ?
Have you ever wanted to create a your own one ?

Now you can do it. Because all the information resides in human readable format in "/proc" directory.
Try doing a "ls /proc" in shell. You will get the following files describes below and some folders. The "PROC" folder is created and modified in runtime by kernel or some system processes. It contains all the information needed to do administrative job. In Windows environment it is very difficult to get all information, but in Linux it's a breeze .

Below is the relavent information about it's files in short , informations regarding directories is given next to it :=>

1) Available files (may be changed ,depending upon Linux version and installed programs!)

file:/proc/cmdline == Kernel Command line (eg . "/rhgb", "quite" etc.
file:/proc/cpuinfo == used cpus and various info about them
file:/proc/crypto == current password encription (such as MD5)
file:/proc/devices == available character(eg terminal,sound etc.) and block device name and corresponding number
file:/proc/diskstats == status about all diskdevice including ramdrive (such as free space,etc.)
file:/proc/dma == dma status (such as cascade)
file:/proc/execdomains == don't know, maybe about kernel domain !
file:/proc/fb == maybe about any pending mails
file:/proc/filesystems == available filesystems (such as : ext3,vfat,etc.)
file:/proc/interrupts == available and usable interrupts and their number
file:/proc/iomem == kernel ram info (may be about available memory mapped io space)
file:/proc/ioports == available system io ports (such as timer,pci,vga+ , etc)
file:/proc/kcore == You can not access it as it is used by kernel itself
file:/proc/kmsg == Kernel Messages
file:/proc/loadavg == CPU Loads and uptime
file:/proc/meminfo == details about memory , including swap,cache,physical memory size and available free space
file:/proc/modules == loded kernel modules (such as snd,alsa,hw,gameport etc.)
file:/proc/mounts ==mounted partitions
file:/proc/partitions == Available Disk Partitions (eg. hda,hda1,...,hdb,.. etc.)
file:/proc/pci == pci devices and their corresponding Bus no.,devive no.,function no. ,irq no. etc.
file:/proc/slabinfo ==
file:/proc/stat == cpu usage info , Includes per cpu load (eg. cpu0,cpu1,...) , context switches , uptime etc.
file:/proc/swaps == Swap partition drive name and size etc.
file:/proc/uptime == Uptime (times elapsed since boot) for individule cpus
file:/proc/version == Linux Kernel version and compiler used to build it
file:/proc/vmstat == Details Virtual memory Info ,including page faults,range,etc.

you can see individual files using command
cat /proc/filename
Such as to view information about cpu issue command:
cat /proc/cpuinfo

2) Available directories (it will certainly be deferrent in your pc!)

The directories with all number such as 1, 4567,2385,112,40,41 etc. are actually PID of the currently Running processes.
Start the default process viewer (in KDE you can try key combination of CTRL+ESC) , see the PID tag list and compare it with the directory listing of the "/proc" directory . You can certainly find similarity in between them. And YES those are the actually PID of those running processes! e.gThe folder having name 1 represents "init" process .

in my pc it is like this :==>

1 2366 2621 3451 3691 3844 9 ide pci
1139 2397 2693 3456 3693 39 acpi interrupts scsi
114 2439 27 3553 3699 3955 asound iomem self
192 2450 2712 3581 37 3997 buddyinfo ioports slabinfo
193 2463 2731 3614 3701 3998 bus irq stat
195 2486 2744 3615 3702 4 cmdline kcore swaps
196 2508 2755 3658 3705 40 cpuinfo kmsg sys
2 2527 28 3661 3706 4084 crypto loadavg sysrq-trigger
209 2537 2893 3663 3712 4089 devices locks sysvipc
2128 2548 3 3666 3713 41 diskstats mdstat tty
2132 2578 3019 3668 38 4192 dma meminfo uptime
2143 2579 3020 3678 3809 4193 dri misc version
2154 2591 3021 3680 3810 4254 driver modules vmstat
2174 26 3022 3682 3811 5 execdomains mounts
2208 2603 3023 3686 3812 6 fb mtrr
2325 2617 3024 3688 3813 7 filesystems net
2355 2619 3025 3689 3814 8 fs partitions

Enter a directory ,let it be "1" , so issue "cd 1", you will be now in folder 1.
view it's contains "ls" :=>

attr cmdline environ fd mem root statm task
auxv cwd exe maps mounts stat status wchan

Explanation of individuals
attr == its a folder containing attributes of all child and parent processes
cmdline == it contains the COMMAND LINE used to create the process , so you can get NAME of the process from here
environ == ENVIRONMENT variable passed to it
fd == its a folder containing file descriptor (opened file handle ?)
mem == memory info ?
root == its a folder link to root directory
statm == memory status ?
task == its a folder containing task number ? (same as it's PID)
auxv == ??
cwd == current working directory
exe == MEMORY IMAGE of the Process . SO YOU CAN DUMP IT EASILY IN RUNTIME , use it for debugging purpose!
maps == ??
mounts == currently mounted devices(mount it used to join different filesystem to root filesystem)
stat == status about the process containg fields such as NICE value,PID,VMsize,Process name etc. (*** Good for making own process information program as it contains all necessary fields****)
status == some of the info from "stat" file but in easily understandable format!
wchan == currently running thread ?

[ LEGENDS : "?" => doubtful ,check it in the internet, "??" => not known to me! ]

Lengthy isn't it ? but it will be comfortable when you get used to it. Keep it's copy locally.

Note to programmers

Now you know the secret of those programs . Why don't you try it ?
Let me know what you have discovered , email me at :

Read data over and over and you will get the recent status , Linux will update it regularly.(so you don't have to be bothered with updation of "/proc" data.) You just have to update the GUI or text interface of your program according to the data provided.

******* Don't keep the files opened for longer as Linux writes to it at regular interval , may cause hang. Close the file as soon as you read it's contains *******


Please pardon my mistake if it is done as I am not a "LINUX GURU" .



Keep Discovering

Last edited by thandermax; 06-25-2005 at 03:44 PM.
Old 06-25-2005, 03:33 PM   #2
LQ Guru
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 58
well this is really nice

what wil be more helpful is ,what parameters generally can be changed to improve the performance in system ,network etc
like we can edit the /proc/vm/swappiness file to make the system less dependent on swap

Old 06-25-2005, 06:10 PM   #3
Registered: Dec 2004
Location: Atlanta, GA U.S.
Distribution: I play with them all :-)
Posts: 316

Rep: Reputation: 30
Thumbs up


This is good stuff. Having an OS provide this much standard information to an applications developer is fantastic! Try doing this with Microsoft

Let me give a testimony if I may. About a year ago I began work on a network monitoring application that would work on both Windows and Linux/Unix. It took me about 3 months of the year (and solid work too) to complete this for the Windows part due to the fact that hardware resources are just not given so easily on a Windows server -- one really must extract it from the base.

On the Linux/Unix side, it took me about 3 weeks because a lot of the work I found out had already been done for me. I do a lot of work in Python. Any of you that works with Python and has to deal with OS issues in programming know that there are way more features available for Unix-based systems just because the damn thing was designed so well from the bottom up unlike another OS that will remain nameless
Old 06-27-2005, 04:37 AM   #4
Registered: Jun 2005
Distribution: OpenSUSE 10.3 , 11.2 , Solaris 10, Ubuntu 9.10
Posts: 84

Original Poster
Rep: Reputation: 16

Thanks for review,

I can provide info on system information on windows platform , but it is not suitable for this forum . So no WIN here !!!!!!
Old 08-01-2005, 10:36 AM   #5
LQ Newbie
Registered: Aug 2005
Location: china
Posts: 4

Rep: Reputation: 0

but I don't understand what each data in /proc/stat stand for?

especially the datas in the cpu line?

can you give me a detail explantation of these datas?

thaks very much!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
System Information Made Easy : Contains of "/proc" folder in details thandermax Linux - News 4 01-17-2006 06:16 PM
/proc/splash: no such file or directory longnam Slackware 1 05-14-2005 04:39 AM
Re-create /proc directory? calabash Red Hat 3 02-18-2004 01:35 AM
proc/splash: No such file or directory asianboi2k Linux - Software 3 11-04-2003 09:20 AM
/proc directory robeb Linux - General 4 06-04-2002 02:34 AM

All times are GMT -5. The time now is 10:37 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration