Where is the source code for the free command on Linux?

Where can I find the source code for the free command on Linux?

The source code for the free commands (and many more, like kill, ps, top, sysctl) can be found in procps-ng:

https://gitlab.com/procps-ng/procps

procps is a set of command line and full-screen utilities that provide information out of the pseudo-filesystem most commonly located at /proc.

This pseudo-filesystem provides a simple interface to the kernel data structures. The programs of procps generally concentrate on the structures that describe the processess running on the system.

The following programs are found in procps:

free - Report the amount of free and used memory in the system
kill - Send a signal to a process based on PID
pgrep - List processes based on name or other attributes
pkill - Send a signal to a process based on name or other attributes
pmap - Report memory map of a process
ps - Report information of processes
pwdx - Report current directory of a process
skill - Obsolete version of pgrep/pkill
slabtop - Display kernel slab cache information in real time
snice - Renice a process
sysctl - Read or Write kernel parameters at run-time
tload - Graphical representation of system load average
top - Dynamic real-time view of running processes
uptime - Display how long the system has been running
vmstat - Report virtual memory statistics
w - Report logged in users and what they are doing
watch - Execute a program periodically, showing output fullscreen
Answered by Eric Z Ma.

Eric Z Ma

Eric is a father and systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *