Process monitoring through strace

I will give an example of running the strace utility, which allows you to track what a process or command is doing at a given moment.

Simple launch:

strace COMMAND
strace -ff COMMAND

Writing the result to a file, with an increase in the length of the line to 512 (default 32):

strace -o /tmp/strace.txt -s 512 COMMAND

Monitoring an already running process:

strace -p PID

To display time before each line:

strace -t -p PID
strace -tt -p PID
strace -ttt -p PID

For example, to make sure a process or command is accessing a specific file:

strace -P /home/ixnfo/test.txt -p PID
strace -P /home/ixnfo/test.txt echo "test" >> /home/ixnfo/test.txt

View Help:

man strace

See also my article:
How on Linux to learn the process PID and terminate it

Leave a comment

Leave a Reply