I'm learning C on Linux and want to understand how programs interact with the operating system. On Windows, people commonly include windows.h, but I'm not sure what the Linux equivalent is. Which libraries or header files should I use for system calls, files, memory, and other OS-level tasks? I'd also appreciate a beginner-friendly guide explaining whether applications ever need to access memory addresses directly.
2 Answers
There isn’t one single Linux equivalent to windows.h. For ordinary C functionality, you use the standard C library and include the header required by each function. Linux also exposes many operating-system features through POSIX APIs and system calls. Some information is available through virtual files such as /proc/meminfo, rather than through one Windows-style API. The POSIX specification and an introductory guide to the C standard library are good places to start.
Use the manual pages to find the correct header for a particular function. For example, running man 2 open shows that open() is declared in . The section number is useful because section 2 contains system calls. If you use an external library, read its documentation for both the required #include files and the linker option, such as -l. You generally should not access arbitrary memory addresses directly; use documented APIs and system calls unless you are working on specialized low-level code.

Other Unix-like systems may provide functions for information such as available memory. For example, BSD systems commonly use sysctl. Linux had an older sysctl interface, but it is no longer the usual approach.