The strace command allows us to trace the system calls made by a program. This is useful for debugging, or simply to find out what a program is doing. In its simplest form, we use strace as follows:
This runs command, with the given command-line arguments, producing a trace of the system calls it makes. By default, strace writes its output to stderr, but we can change this using the -o filename option.
Examples of the type of output produced by strace include the following (taken from the output of the command strace date):
execve("/bin/date", ["date"], [/* 114 vars */]) = 0 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY) = 3 fstat64(3, ...