strace is an open source and freely distributed software designed for developers and system administrators, providing a system call tracer implemented in C and designed to run exclusively under GNU/Linux operating systems.

The program is a very useful debugging, instructional and diagnostic utility that can gather all the system calls generated by a program or a process, and print out a trace. It’s a command-line program that can only be used from a console environment or via a terminal emulator app.

The tool can be used by diagnosticians, troubleshooters, as well as system administrators who want a priceless solution for solving problems with closed-source programs. It is written by Dmitry V. Levin, Roland McGrath and Wichert Akkerman.

Command-line options

Like any other command-line software, strace offers a wide variety of command-line options that allow the user to easily use all of its functionality and features in order to achieve their tasks. All of its command-line options can be viewed at a glance by running the ‘strace --help’ command.

Among the most interesting command-line options, we can mention support for counting times, calls and errors for each syscall, support for summarizing syscall latency, support for tracing accesses to a certain path, support for enabling debug output to stderr, as well as support for running a tracer process as a detached grandchild, not as a parent.

Additionally, you will be able to send trace information to a specific file instead of stderr, to set the overhead for tracking syscalls to an overhead usecs, to set a PID file for the trace process, to limit the length of print strings to strsize chars, to run commands as username handling setgid and/or setuid, and to detach on a specific syscall.

Getting started with strace

strace is only distributed as a source tarball, but it can be easily installed on numerous distributions of Linux from their main software repositories. To install it from sources, simply download the latest version from Softpedia, save the archive on a location of your choice and unpack it.

Open a Terminal app, go to the location of the extracted archive files (e.g. cd /home/softpedia/strace-4.9), run the ./configure && make’ command to configure and compile strace, and then execute the ‘make install’ command as root or the ‘sudo make install’ command as a privileged user to install strace system wide.