ARTICLE

Understanding /proc
Contributed by Andy Kissner in Misc on 2006-03-09 16:08:31

Throughout my experience, many users on Linux Help Forums or IRC have had questions that require information from /proc to diagnose. And every single time, I've had to walk them through the process of using and understanding /proc so that I could help them with their problem. For that reason, I think that a brief tutorial on the basics of /proc is in order.

When it comes down to it, /proc is a filesystem. Although it does not represent any physical device, you can still mount it and unmount it as you please. It contains a multitude of valuable information regarding the processes you are running, as well as the hardware you have hooked up to your computer (although in recent years, /sys has been devised by the Kernel folks to represent the hardware hierarchy and export device information ). You can see which modules you have loaded, how long your system has been up, and the memory usage of processes on your system. In fact, every single process running has an entry, or directory, inside /proc. As you can see, /proc can be a very powerful asset. But before you can use it, you need to mount it.

Note: Many of the examples in this guide require root access to work correctly. If you don't have root access on your Linux box, get it. We'll wait.



Article Index
Understanding /proc
Mounting /proc
Viewing Process Information
 
Discussion(s)
A bag of helpful information
Written by Rainer Klein on 2006-03-12 18:05:20
Great article, thanks.

IMHO there is one minor typo. I believe the test statement should read:

test -d /proc
Discuss! Reply!

Ah...thanks
Written by Andy Kissner on 2006-03-15 13:44:56
Yes, there was a typo, but your correction isn't entirely, well, correct. haha
It should be:

if ! test -d /proc
then
mkdir /proc
fi
Discuss! Reply!

Very Informative
Written by Moss on 2006-05-04 02:06:29
Very informative. Everything about /proc processes in one article
Discuss! Reply!

/Tasks Pointless !?
Written by Cyber_Fusion on 2006-05-25 05:55:25
task - task is a directory, containing a directory (with the same name as the PID) that contains all the information inside /proc/XXXX (except for task/). It's a bit of a pointless directory, in my opinion.

(LOL) Pointless... Actually it lists all the processes tasks as subdirs, THREADS included (with their own ID), the importance of this reflection is only obvious when one has to work with context changable threads or child processes. The information is extremelly usefull for k2.6 under NPTL, for instance.
Discuss! Reply!