Home > Article > Backend Development > How to use Strace debugging tool_PHP tutorial
strace is a program debugging tool in the Linux environment, used to monitor the system calls used by an application and the system information it receives.
strace is a useful little tool that lets you know what a program is doing in the background by tracing system calls. Strace is a basic debugging tool that is installed by default on most Linux systems; but it is an excellent piece of software even when you are not tracking a problem. It can tell you a lot about how a Linux program works.
Let's start with a simple UNIX command, pwd, and then dig deeper into what the command does in accomplishing its task. Start xterm to create a controlled environment in which to experiment, and enter the following command:
$ pwd
The pwd command displays the current working directory. On my computer, the output was:
/home/bill/
Such a simple function belies the underlying complexity of the command (BTW (For a moment, all computer programs are like this). To really understand the complexity, run the pwd command again using the strace tool:
$ strace pwd
With this command, you can see that, in the display and In the process of enumerating the current working directory, the UNIX computer performs quite a few operations.