Pages

Friday, April 18, 2014

Shows cpu load in percent

$ top -bn2|awk -F, '/Cpu/{if (NR>4){print 100-gensub(/.([^ ]+).*/,"\\1","g",$4)}}'

This version is precise and requires one second to collect statistics. Check sample output for a more generic version and also a remote computer invocation variant. It doesn't work with the busybox version of the 'top' command but can be adjusted




commandlinefu.com


by David Winterbottom (codeinthehole.com)






from All commands http://ift.tt/1leB1WZ

No comments:

Post a Comment