strace <command>Runs a program and prints every system call with arguments and return values to stderr.
Example
strace ./appTraces the system calls and signals of a process — see which files it opens, what it sends and why it fails.
sudo apt install stracestrace <command>Runs a program and prints every system call with arguments and return values to stderr.
Example
strace ./appstrace -p <pid>Attaches to a running process.
Example
sudo strace -p 1337strace -f <command>Follows child processes and threads.
Example
strace -f ./serverstrace -o <file> <command>Writes the trace to a file.
Example
strace -o trace.txt ./appstrace -ff -o <prefix> <command>One output file per process (trace.<pid>).
Example
strace -ff -o trace ./serverstrace -e trace=<calls> <command>Only the listed system calls.
Example
strace -e trace=openat,read ./appstrace -e trace=%file <command>Every call that takes a file name — shows config files and libraries it looks for.
Example
strace -e trace=%file ./appstrace -e trace=%network <command>Network calls: socket, connect, sendto and friends.
Example
strace -e trace=%network curl -s example.comstrace -e trace=%process <command>Process lifecycle: fork, clone, execve, exit.
Example
strace -f -e trace=%process ./installerstrace -e trace=execve -f <command>Every program a script launches.
Example
strace -e trace=execve -f ./setup.shstrace -e status=failed <command>Only calls that failed (strace 5.2+) — quickly shows missing files and permission errors.
Example
strace -e status=failed ./appstrace -s <n> <command>Shows up to n characters of string arguments (default 32).
Example
strace -s 256 -e trace=write ./appstrace -tt -T <command>Microsecond timestamps and time spent in each call.
Example
strace -tt -T ./appstrace -c <command>A summary table of call counts, errors and time instead of a full trace.
Example
strace -c ./appstrace -y <command>Prints the path behind each file descriptor.
Example
strace -y ./appstrace -k <command>Prints a stack trace for each call.
Example
strace -k -e trace=openat ./app