Wednesday, August 20, 2008

linux proc filesystem tutorial Part-1

A brief /proc walkthrough

The /proc filesystem contains a few basic directories and entries

$ ls -l /proc

First of all, the filesystem contains a large set of numbered directories that come and go. These numbered directories contains information about all of the currently active processes on the machine. When a new process is started, a new directory is created in the /proc filesystem for it, and a lot of data is created within it. eg: commandline with which the program was started with, a link to the "current working directory", environment variables, where the executable is located, and so on.

Most of the information in the files are readable , except a few of them. However, a few of them you should not touch, such as the kcore file. The kcore file contains debugging information regarding the kernel, and if you try to 'cat' it, your system may very well hang up and die. If you try to copy it to a real file on the harddrive, you will very soon have filled up your whole partition, and so on. What all of this tells you is to be very careful. Mostly, none of the variables or entries in the /proc filesystem is not dangerous to watch, but a few of them are.

A brief walkthrough of the most important files in part - 2 wait......

No comments: