3

I've got a process that I want to inspect with strace, but since it's printing out a lot of stuff, I would like to sample only a few lines every X seconds from it. Is there any way of doing that with bash or similar?

For example:

strace -p 123456 | "print out most recent 80 lines every 2 seconds"

1 Answer 1

3

Yes:

strace -p $PID >$PID.log &
watch tail -n80 $PID.log >$PID-sample.log &
tail -f $PID-sample.log

or just watch tail -n$LINES $PID.log if you don't need to scroll back through the sampled log.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .