An example on running truss

truss is a command that traces system calls and signals on Solaris. An equivalent tool on Linux is strace. You can also use Dtrace, which can be much lighter weight. If you ever wan to give truss a try, here is an example:

truss -aefltexec,fork,open,close,creat -o /tmp/truss.out my_command

This one-line command will produce a large ASCII file at /tmp/truss.out (-o) that shows the following:

  • The argument strings that are pased in each exec() call (-a)
  • Shows the environment strings passed in each exec() call (-e)
  • Follows all children process created by fork() or vfork() calls (-f)
  • Trace exec, fork, open, close, and create system calls (-t) (Note: Default is -tall. You can also add “!” in front of a system call to exclude tracing it. )

One thought on “An example on running truss

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s