strace traces system calls and signals made by a process. It is useful when a program fails but the error message does not explain what happened.
Trace a command
strace ls /tmp
Attach to a running process
strace -p 1234
Save output to a file
strace -o trace.log command
Common things to look for are missing files, permission errors, failed network calls and repeated retries.