Name

strace

Synopsis

strace [options] command [arguments]

Trace the system calls and signals for command with optional arguments. strace shows you how data is passed between the program and the kernel. With no options, strace prints a line for each system call. It shows the call name, given arguments, return value, and any generated error messages. A signal is printed with both its signal symbol and a descriptive string. As it shows the data transfer between user and kernel-space, strace is very useful as both a diagnostic utility for system administrators and a debugging tool for programmers. By default, the output is written to standard error.

Options

-a n

Align the return values in column n. The default is 40.

-c

Count system calls, errors, signals, and time and provide a summary report when the program has ended.

-d

Debug mode. Print debugging information for strace on stderr.

-e [keyword=][!]values

Pass an expression to strace to limit the types of calls or signals that are traced or to change how they are displayed. If no keyword is given, trace is assumed. The values can be given as a comma-separated list. Preceding the list with an exclamation point (!) negates the list. The special values all and none are valid, as are the values listed with the following keywords:

abbrev=names

Abbreviate output from large structures for system calls listed in names.

read=descriptors

Print all data read from the given file descriptors.

signal=symbols

Trace the listed signal symbols (for example, signal= ...

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.