Search notes:

Shell command: strace

strace traces (intercepts) system calls and signals of a specific programs. Thus, it is a valuable debugging tool.
strace does not need the source code of the examined program.

Default output stream is STDERR

strace writes to stderr by default.
If output should go to stdout, for example to pipe it into grep, the output can be redirected like so:
$ strace … 2>&1 | grep …
It's also possible to write the output to a file whose name is specified with the -o command line option.

Security

Which processes strace can attach to is controlled by the kernel.yama.ptrace_scope kernel parameter.
The value of this kernel parameter can be changed like so:
sudo sysctl kernel.yama.ptrace_scope = 0

See also

Shell commands
ptrace.

Index