Under Linux, there is a special FileSystem mounted under /proc that gives access to the Linux Kernel settings and information.
Some of the information you can find includes:
- a subdirectory for each current process. You can find things like the command line, the environment, memory and file usage. There is a special directory called "self" that refers to whichever process accesses it. For example, you can do less /proc/self/status to find out about the less process, or you can do cd /proc/self ; less status to find out about your shell process.
- /proc/cpuinfo gives information about the detected CPU(s), including manufacturer, id, known bugs, and extensions.
- FileSystems and peripherals. For example, when you attach a USB device such as a DigitalCamera, your programs communicate with the device through a file with a name like /proc/bus/usb/001/003.
- sysctl's are available via /proc/sys/
- network devices and status.
Also, the SuperUser can change some Kernel settings by writing to particular files. For example, to allow your Linux machine to act as a router by forwarding packets from other machines, it is necessary (but usually already automated) to do echo 1 > /proc/sys/net/ipv4/ip_forward.
Writing programs that get information from /proc is a good way to make them non-Portable to other Unix(-like) systems.
See also: