![Forrest logo](/images/logo.png)
truss
Truss is a command line tool used in Unix-like operating systems, including Linux and macOS, to trace system calls and signals. It provides a detailed analysis of the system calls made by a program during its execution. The output generated by truss includes information about the arguments passed to system calls, their return values, and any associated error codes.
Truss can be used to debug and analyze the behavior of programs, especially when troubleshooting issues related to system calls. It can help identify issues such as incorrect arguments passed to system calls, unexpected return values, or errors that might occur during the execution of a program.
With truss, you can track the sequence and timing of system calls, as well as observe any signals sent or received by the program. This can provide valuable insights into the program's interactions with the underlying operating system and help diagnose any performance bottlenecks, synchronization problems, or resource allocation issues.
The output from truss can be quite verbose, so it supports various options to filter and format the results, allowing you to focus on specific system calls or events of interest. It also provides options to redirect the output to a file for later analysis or post-processing.
Truss is a powerful tool for system administrators, developers, and anyone involved in diagnosing or debugging software issues. By tracing the low-level interactions between a program and the operating system, truss provides a valuable tool for understanding and troubleshooting system-level behavior.
List of commands for truss:
-
truss:tldr:5979e truss: Start tracing a program by executing it, following all child processes.$ truss -f ${program}try on your machineexplain this command
-
truss:tldr:c99aa truss: Start tracing a specific process by its PID.$ truss -p ${pid}try on your machineexplain this command
-
truss:tldr:e19af truss: Count time, calls, and errors for each system call and report a summary on program exit.$ truss -c -p ${pid}try on your machineexplain this command
-
truss:tldr:e1b93 truss: Trace a process filtering output by system call.$ truss -p ${pid} -t ${system_call_name}try on your machineexplain this command
-
truss:tldr:e999f truss: Start tracing a program by executing it, showing arguments and environment variables.$ truss -a -e ${program}try on your machineexplain this command