Everyday system calls
Several syscalls are happening in our programs every time under our noses. We can trace these calls using the strace
tool.
Tracing system calls
The strace
tool might not come pre-installed on all Linux distributions, but it’s available in most official repositories. Here’s how to install it on some major distributions.
Debian (using APT): Run the following command:
apt-get install strace -y
Red Hat family (using DNF and YUM)
- When using
yum
, run the following command:yum install strace
- When using
dnf
, run this command:dnf install strace
Arch Linux (using Pacman): Run the following command:
pacman -S strace
Basic strace usage
The basic way to use strace
is by calling the strace
utility followed by the program’s name; for example:
strace ls
This will produce an output showing system calls, their arguments, and return values. For instance, the execve
system call (https://man7.org/linux/man-pages/man2...