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. )
Advertisements

One thought on “An example on running truss

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s