ARTICLE

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

Mounting /proc

As mentioned earlier, /proc is a filesystem. And, like all filesystems, you need to mount it. In theory, you could mount it anywhere, but the standard is to mount it in /proc.

Most systems have /proc mounted by default in /etc/fstab, but just in case, make sure that it's mounted by doing:

$ mount

Note: Throughout this guide, $ indicates a command to be run from a normal user's shell, and # indicates something that must be run from a root shell.

If the output contains a line such as:

proc on /proc type proc (rw)

then you are fine. If not, follow the instructions below.

First, make sure that you have a directory called /proc:

# if ! test -f /proc
then
mkdir /proc
fi

Then, add a line to the file /etc/fstab such as this:

proc		/proc	proc		defaults		0 0

Now, mount it:

# mount proc

You're now ready to play around with /proc.



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!