Adventures in /proc
/proc is a bridge to read kernel data and configure parameters.
You can find many of the data sources that common utilities use.
In-depth kernel data
You can also get far more in-depth data directly from the kernel.
Data on individual processes can be queried from
/proc/self. Much of this data is available from flags to
cwd- symlink to the running binary
environ- environment variables are NUL separated, use something like
tr \0 \nto clean up
fd/- directory of symlinks to open files
maps- library addresses
Interacting with the kernel
Some parameters can be modified directly through
/proc, in addition to something like
sysctl -w vm.swappiness
echo 3 > /proc/sys/vm/drop_caches- drop filesystem cache