strace -e trace=file -fp PID
(file) or strace -e trace=desc -fp PID
(file descriptors)
Common calls:
access
close
– 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
Reads and writes to the sockets can be traced via trace=desc
.
strace -e trace=memory -fp PID
Common syscalls:
mmap
munmap
-c
– current statistics about what time is spend where (combine with-S
for 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
– network syscalls-e trace=process
– process calls (like fork, exec)-e trace=signal
– process signal handling (like HUP, exit)-e trace=file
– file related syscalls-e trace=desc
– all file descriptor related system calls
Tracing multiple syscalls
Monitor opening/closing of files via strace -e open,close
I think the
-e trace=network
should mention "network syscalls" instead of "memorysyscalls"..Also you may mention
-e trace=desc
in the "strace cli options" section under "Tracking via specific system call group" as well.. Although you have mentioned it on the top, it will be good to add here as this consolidates options for the-e
switch..?From
man strace
-