Linux /proc and Process Debugging/Attach strace to a running PID

Attach to a live process and trace syscalls.

Section: Tracing System Calls and Libraries

Attach strace to a running PID

bash
bash
sudo strace -p 1234
Explanation

Attach to a live process and trace syscalls.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Tracing System Calls and Libraries
Trace a command with strace
Trace syscalls made by a new command.
OpenIn sheetbashsame section
Trace child processes too
Write one trace file per process and follow forks.
OpenIn sheetbashsame section
Trace network syscalls
Focus on network-related system calls only.
OpenIn sheetbashsame section
Trace file syscalls
Focus on file and pathname operations.
OpenIn sheetbashsame section
Trace library calls
Trace dynamic library calls if ltrace is installed.
OpenIn sheetbashsame section
Profile hot code paths
Sample hot functions on the system in real time.
OpenIn sheetbashsame section