PROC(5) Linux Programmer's Manual PROC(5)
NAME
proc - process information pseudo-filesystem
DESCRIPTION
/proc is a pseudo-filesystem which is used as an interface to kernel data structures rather than reading and interpreting /dev/kmem. Most
of it is read-only, but some files allow kernel variables to be changed.
The following outline gives a quick tour through the /proc hierarchy.
[number]
There is a numerical subdirectory for each running process; the subdirectory is named by the process ID. Each contains the follow-
ing pseudo-files and directories.
cmdline
This holds the complete command line for the process, unless the whole process has been swapped out, or unless the process is
a zombie. In either of these later cases, there is nothing in this file: i.e. a read on this file will return 0 characters.
The command line arguments appear in this file as a set of null-separated strings, with a further null byte after the last
string.
cwd This is a link to the current working directory of the process. To find out the cwd of process 20, for instance, you can do
this:
cd /proc/20/cwd; /bin/pwd
Note that the pwd command is often a shell builtin, and might not work properly. In bash, you may use pwd -P.
environ
This file contains the environment for the process. The entries are separated by null characters, and there may be a null
character at the end. Thus, to print out the environment of process 1, you would do:
(cat /proc/1/environ; echo) | tr "