This collection provides a number of examples and cheatsheets for commonly used
libc functions and system calls for the Linux operating system. It gives a short description of each function and provides examples for their usage.
Functions are grouped in several categories, which cover specific use cases, respectively. For each category an overview of the involved functions and files is given followed by an example for the typical usage of these functions. After the usage example, a more detailed description of each function is given.
However, cheatsheets can not replace the thorough study of the corresponding manpages for more detailed information. Manpages can be retrieved using the following command:
Please use the following compiler flags for your exercises. These are the flags used to compile your Linux submissions.
CFLAGS = -std=c11 -pedantic -D_XOPEN_SOURCE=700 -Wall -Werror -O3
- Errno Variable
Explanation of the
Functions to (de-)allocate memory.
Functions to analyze and manipulate C strings.
List of functions:
- directory handling: opendir(), closedir(), readdir()
- file handling: fopen(), fclose(), stat(), lstat()
Functions for file and directory handling (i.e., opening/closing files and retrieving metadata).
Functions for (formatted) input and output.
Functions to create new processes and wait for the termination of processes. Furthermore, functions to execute a new program in a process.
Functions to deliver, synchronize, and wait for POSIX signals in Linux.
Functions to create, synchronize, and wait for POSIX threads (pthreads).
Here you can find and download a PDF version (and a compact PDF version optimized for printing) of this documentation.