strace is a diagnostic, debugging, and instructional userspace utility for Linux. It is used to monitor and tamper with interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes in process state.
System administrators, diagnosticians, and troubleshooters will find it invaluable for solving problems with programs for which the source is not readily available since they do not need to be recompiled in order to trace them.
The operation of strace is made possible by the kernel feature known as ptrace.
Some of the features
Attach to an already running process
$ strace -p 26380 strace: Process 26380 attached ...
Filter by type of syscall
-e trace=%desc Trace all file descriptor related system calls. %file Trace all system calls which take a file name as an argument. %fstat Trace fstat and fstatat syscall variants. %fstatfs Trace fstatfs, fstatfs64, fstatvfs, osf_fstatfs, and osf_fstatfs64 system calls. %ipc Trace all IPC related system calls. %lstat Trace lstat syscall variants. %memory Trace all memory mapping related system calls. %network Trace all the network related system calls. %process Trace all system calls which involve process management. %pure Trace syscalls that always succeed and have no arguments. %signal Trace all signal related system calls. %stat Trace stat syscall variants. %statfs Trace statfs, statfs64, statvfs, osf_statfs, and osf_statfs64 system calls. %%stat Trace syscalls used for requesting file status. %%statfs Trace syscalls related to file system statistics.