vmstat/iostat with timestamp

vmstat 1 | awk '{now=strftime("%Y-%m-%d %T "); print now $0}'
Also useful with iostat, or pretty much anything else you want timestamped.
Sample Output
2009-07-17 15:36:17 procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
2009-07-17 15:36:17  r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
2009-07-17 15:36:17  1  0    256  91276 226008 6461180    0    0   278   640    1     3  8  2 83  7
2009-07-17 15:36:18  0  0    256  74252 226524 6478072    0    0  5108 17316 5477  4731 12  3 78  7
2009-07-17 15:36:19  0  1    256  68228 226984 6483120    0    0  5580  1556 3236  5477  6  2 81 11
2009-07-17 15:36:20  1  1    256  57708 227680 6491604    0    0  5428  8384 3927  6805  7  6 76 12

8
2009-07-17 07:41:57

What Others Think

To make it shorter, you can replace %Y-%m-%d with %F.
bbock · 486 weeks and 5 days ago
this is useful to me thanks
etescartz · 486 weeks and 5 days ago
this is useful to me too thanks
Gomex · 486 weeks and 2 days ago
it's good
zhujian0805 · 426 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: