Jump to content
Old threads will finally start getting archived ×

grepping the linux "time" command


fiddlehead_cons

Recommended Posts

Phellow Phreaks!
I'm trying to track the CPU usage of a short Linux script that I wrote called clientFeeder.do.  I want to grep out the system cpu time and log it into a file.  However, when I run the command:

time . clientFeeder.do >> grep sys 2>&1

I get all three times, real, user, and sys.

real    0m1.685s
user    0m0.033s
sys    0m0.027s

Can anyone tell me what I'm doing wrong?  ???  I just want the sys time, not the other two lines.  Thanks!

Warm regards,
James
Link to comment
https://forums.phpfreaks.com/topic/31314-grepping-the-linux-time-command/
Share on other sites

well, you're close, but not quite - the syntax would actually be:

[code]$ time foobar 2>&1 | grep sys[/code]

It's odd, though - grep still doesn't seem to catch it, when I try it. Other stderr redirection works fine for me, but not with time. I suspect it's because time is a utility within bash, and that throws things off, for whatever reason.
  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.