Output system statistics every 5 seconds with timestamp

while [ 1 ]; do echo -n "`date +%F_%T`" ; vmstat 1 2 | tail -1 ; sleep 4; done
See man vmstat for information about the statistics. This does the same thing without the timestamp: vmstat 5
Sample Output
2009-03-26_15:13:49 0  0    536  27724   4236 699064    0    0     0     0 1306   413  2  1 98  0
2009-03-26_15:13:54 0  0    536  27212   4244 699576    0    0     0     0 1182   266  1  0 99  0
2009-03-26_15:13:59 0  0    536  26764   4252 699828    0    0     0     0 1229   330  1  0 98  0
2009-03-26_15:14:04 0  0    536  26508   4260 700080    0    0     0     0 1307   465  2  1 98  0

2009-03-26 19:16:55

What Others Think

Do any of you need an affordable yet durable customized wallpaper? Check out https://www.digitekprinting.com/foam-core-posters link and get your own in an instant. My interior designer worked with them for the renovation of my house and It’s been years and it still looks new. It also is odor-free, PVC-free, and has an ultra smooth feel. I can’t believe that I was able to buy this with the price I paid.
seooo · 8 weeks and 5 days ago
Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. product launch
seooo · 7 weeks and 5 days ago
Many thanks for being the mentor on this niche. We enjoyed the article greatly and most of all appreciated how you really handled the issues I regarded as being controversial. You are always very kind towards readers really like me and assist me to in my life. Thank you. Palm Beach Gardens cavitation slimming machines
seooo · 7 weeks and 1 day ago
I was surfing the Internet for information and came across your blog. I am impressed by the information you have on this blog. It shows how well you understand this subject. buy youtube views
seooo · 4 weeks and 4 days ago
We have a fantastic range of quality products available at our main site, including domestic spares, shaver spares, health care products and much more! ????????
seooo · 1 week and 4 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: