Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How to run a truss command with piped output?

eg.

# truss -leDo /tmp/truss.out tar cvf - dirs/ | gzip -1 > archive.tar.gz

I get only the "tar" output in truss, not from gzip!

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Have you tried using -f ? It tells truss to follow any children the original command spawns. I'm not sure if that will work because the tar command isn't actually spawning the gzip command.

The other option that might work is:

truss -leDo /tmp/truss.tar.out tar cvf - dirs/ | truss -leDo /tmp/truss.gzip.out gzip -1 > archive.tar.gz

Again, however, I don't know if it will work but this time it's because I don't know what truss does to STDIN.

If both of those fail, you might get somewhere by using the -f option and wrapping both of them in a shell:

truss -leDo /tmp/truss.out ( tar cvf - dirs/ | gzip -1 > archive.tar.gz )

This one requires bash but it could be modified to run under other shells.

All of this is assuming that you want the tar and gzip command separate. If you don't need that, you could just use the -z option to tar to have it do the compression.

share|improve this answer
    
First option worked! –  M_1 Dec 13 '11 at 8:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.