Linux stores a lot of system data in the /proc
directory. Information about the os can be found in /etc/os-release/
.
You can find:
- kernel information in
/proc/version
- memory utilization in
/proc/meminfo
- process information in
/proc/stat
- uptime information (total uptime + idle uptime)
/proc/uptime
- directories with integer names: these correspond to running processes
You can checkout the proc manpages for more details.
The author of htop
explains on stackoverflow how he uses meminfo
to calculate the stats you can see in htop
:
- Total used memory = MemTotal - MemFree
- Non cache/buffer memory (green) = Total used memory - (Buffers + Cached memory)
- Buffers (blue) = Buffers
- Cached memory (yellow) = Cached + SReclaimable - Shmem
- Swap = SwapTotal - SwapFree