{"tool":"strace","name":"strace","description":"Traces the system calls and signals of a process — see which files it opens, what it sends and why it fails.","tags":["tracing","system calls","debugging"],"homepage":"https://strace.io","docs":"https://man7.org/linux/man-pages/man1/strace.1.html","install":{"apt":"sudo apt install strace","dnf":"sudo dnf install strace"},"related":["gdb","ps"],"total_commands":18,"commands":[{"id":11,"category":"Tracing","command":"strace <command>","example":"strace ./app","explanation":"Runs a program and prints every system call with arguments and return values to stderr."},{"id":4,"category":"Tracing","command":"strace -p <pid>","example":"sudo strace -p 1337","explanation":"Attaches to a running process."},{"id":12,"category":"Tracing","command":"strace -f <command>","example":"strace -f ./server","explanation":"Follows child processes and threads."},{"id":13,"category":"Tracing","command":"strace -o <file> <command>","example":"strace -o trace.txt ./app","explanation":"Writes the trace to a file."},{"id":14,"category":"Tracing","command":"strace -ff -o <prefix> <command>","example":"strace -ff -o trace ./server","explanation":"One output file per process (trace.<pid>)."},{"id":15,"category":"Filtering","command":"strace -e trace=<calls> <command>","example":"strace -e trace=openat,read ./app","explanation":"Only the listed system calls."},{"id":16,"category":"Filtering","command":"strace -e trace=%file <command>","example":"strace -e trace=%file ./app","explanation":"Every call that takes a file name — shows config files and libraries it looks for."},{"id":17,"category":"Filtering","command":"strace -e trace=%network <command>","example":"strace -e trace=%network curl -s example.com","explanation":"Network calls: socket, connect, sendto and friends."},{"id":18,"category":"Filtering","command":"strace -e trace=%process <command>","example":"strace -f -e trace=%process ./installer","explanation":"Process lifecycle: fork, clone, execve, exit."},{"id":19,"category":"Filtering","command":"strace -e trace=execve -f <command>","example":"strace -e trace=execve -f ./setup.sh","explanation":"Every program a script launches."},{"id":20,"category":"Filtering","command":"strace -e status=failed <command>","example":"strace -e status=failed ./app","explanation":"Only calls that failed (strace 5.2+) — quickly shows missing files and permission errors."},{"id":21,"category":"Detail and timing","command":"strace -s <n> <command>","example":"strace -s 256 -e trace=write ./app","explanation":"Shows up to n characters of string arguments (default 32)."},{"id":22,"category":"Detail and timing","command":"strace -tt -T <command>","example":"strace -tt -T ./app","explanation":"Microsecond timestamps and time spent in each call."},{"id":23,"category":"Detail and timing","command":"strace -c <command>","example":"strace -c ./app","explanation":"A summary table of call counts, errors and time instead of a full trace."},{"id":24,"category":"Detail and timing","command":"strace -y <command>","example":"strace -y ./app","explanation":"Prints the path behind each file descriptor."},{"id":25,"category":"Detail and timing","command":"strace -k <command>","example":"strace -k -e trace=openat ./app","explanation":"Prints a stack trace for each call."},{"id":26,"category":"Library calls","command":"ltrace <command>","example":"ltrace ./crackme","explanation":"Traces calls into shared libraries — strcmp calls often reveal hard-coded passwords."},{"id":27,"category":"Library calls","command":"ltrace -e <function> <command>","example":"ltrace -e strcmp ./crackme","explanation":"Traces only the named library function."}],"slug":"strace","category":"reversing","url":"https://terminal.rokibulroni.com/tool/reversing/strace","markdown":"https://terminal.rokibulroni.com/api/v1/tools/reversing/strace.md"}