Strace

From TBP Wiki
Jump to: navigation, search

strace is a diagnostic, debugging and instructional userspace utility for Linux. It is used to monitor and tamper with interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state. The operation of strace is made possible by the kernel feature known as ptrace.

Some Unix-like systems provide other diagnostic tools similar to strace, such as truss.

Examples

To use strace, find out the PID

   ps aux |grep NAME

It'll provide an output with the PID

   strace -p PID

Make it quick and easy:

   strace -p $(ps aux | grep PROCESS | grep -vi grep | awk '{print $2}')

Don't forget to replace PROCESS with the name of the process you want to strace.