Chapter 31. The /proc File System The /proc (Web hosting plans)
Chapter 31. The /proc File System The /proc file system is specific to GNU/Linux. It is a virtual file system, so the files that you will find in this directory do not actually take up any space on your hard drive. It is a very convenient way to obtain information about the system, especially since most files in this directory are human readable (well, with a little help). Many programs actually gather information from files in /proc, format it in their own way and then display the results. There are a few programs which display information about processes (top, ps and friends) which do exactly that. /proc is also a good source of information about your hardware, and just like the programs which display processes, quite a few programs are just interfaces to the information contained in /proc. There is also a special subdirectory, /proc/sys. It allows you to display kernel parameters and to change them, with the changes taking effect immediately. 1. Information About Processes If you list the contents of the /proc directory, you will see many directories where the name of the directory is a number. These are the directories containing information on all processes currently running on the system: $ ls -d /proc/[0-9]* /proc/1/ /proc/302/ /proc/451/ /proc/496/ /proc/556/ /proc/633/ /proc/127/ /proc/317/ /proc/452/ /proc/497/ /proc/557/ /proc/718/ /proc/2/ /proc/339/ /proc/453/ /proc/5/ /proc/558/ /proc/755/ /proc/250/ /proc/385/ /proc/454/ /proc/501/ /proc/559/ /proc/760/ /proc/260/ /proc/4/ /proc/455/ /proc/504/ /proc/565/ /proc/761/ /proc/275/ /proc/402/ /proc/463/ /proc/505/ /proc/569/ /proc/769/ /proc/290/ /proc/433/ /proc/487/ /proc/509/ /proc/594/ /proc/774/ /proc/3/ /proc/450/ /proc/491/ /proc/554/ /proc/595/ Note that as a user, you can (logically) only display information related to your own processes, but not those of other users. So, login as root and see what information is available from process 1, which is the init process and is the one responsible for starting up all other processes: $ su Password: # cd /proc/1 # ls -l total 0 -r——–1 root root 0 Aug 15 18:14 auxv -r–r–r–1 root root 0 Aug 15 18:14 cmdline