Pages

Friday, April 18, 2014

Shows cpu load in percent

$ sed -e 's/ .*//' -e 's/\.//' -e 's/^0*//' /proc/loadavg

Show the current load of the CPU as a percentage.


Read the load from /proc/loadavg and convert it using sed:


Strip everything after the first whitespace:


sed -e 's/ .*//'

Delete the decimal point:


sed -e 's/\.//'

Remove leading zeroes:


sed -e 's/^0*//'


commandlinefu.com


by David Winterbottom (codeinthehole.com)






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

No comments:

Post a Comment