strace flags & options

-p

Attach to a running process by PID.

sudo strace -p 1234

-e

Filter which system calls to trace.

strace -e open,read,write ls
strace -e trace=network curl example.com
strace -e trace=file ls

-f

Follow child processes created by fork.

strace -f ./server

-c

Print a summary of syscall counts, times, and errors.

strace -c ls /tmp

-o

Write trace output to a file instead of stderr.

strace -o trace.log ls
strace -o trace.log -f ./server

-t

Prefix each line with a timestamp.

strace -t ls
strace -tt ls

-s

Set the maximum string size to print (default 32).

strace -s 256 -e read,write curl example.com

-ff

Write each process's trace to a separate file (use with -o).

strace -ff -o traces ./multiprocess_app