Skip to main content
2 of 3
deleted 3 characters in body
cuonglm
  • 158.2k
  • 41
  • 342
  • 420

In Linux, you have strace:

strace -f sh -c 'grep word1 file > file.txt' 

Here we use -f to tell strace to trace child process.

In *BSD, you have dtruss (which use dtrace underlying):

dtruss -f sh -c 'grep word1 file > file.txt' 
cuonglm
  • 158.2k
  • 41
  • 342
  • 420