strace -e trace=file -fp PID (file) or strace -e trace=desc -fp PID (file descriptors)
Common calls:
accessclose– close file handlefchmod– change file permissionsfchown– change file ownershipfstat– retrieve detailslseek– move through fileopen– open file for reading/writingread– read a piece of datastatfs– retrieve file system related details
strace -o /tmp/strace.out -s 10000 -e trace=network -fp PID
Common syscalls:
bind– link the process to a network portlisten– allow to receive incoming connectionssocket– open a local or network socketsetsockopt– define options for an active socket
strace -e trace=memory -fp PID
Common syscalls:
mmapmunmap
-c– current statistics about what time is spend where (combine with-Sfor sorting)-f– track process including forked child processes-o somefile.out– write output to a file-p PID– track a process by PID-P /tmp– track interaction with a path-s 10000– maximum string size to output (32 by default)-T– include syscall duration in output
Tracking via specific system call group:
-e trace=ipc– communication between processes (IPC)-e trace=memory– memory syscalls-e trace=network– memory syscalls-e trace=process– process calls (like fork, exec)-e trace=signal– process signal handling (like HUP, exit)-e trace=file– file related syscalls
Tracing multiple syscalls
Monitor opening/closing of files via strace -e open,close