title: How to get percentage of processor use with bash?
body: <p>I wonder how do I get the percentage of my processor usage from 0% to 100%?</p>
  
  <p>to know how many percent'm using my processor preferably in bash or other methods provided that percentage.</p>
  
  <p>I have this script that I found on google however it is very much imprecisso
  I tried to make more improvements could not, does anyone know any method to get the percentage of CPU utilization in% 0-100</p>
  
  <p>my script</p>
  
  <pre><code>NUMCPUS=`grep ^proc /proc/cpuinfo | wc -l`; FIRST=`cat /proc/stat | awk '/^cpu / {print $5}'`; sleep 1; SECOND=`cat /proc/stat | awk '/^cpu / {print $5}'`; USED=`echo 2 k 100 $SECOND $FIRST - $NUMCPUS / - p | dc`; echo ${USED}% CPU Usage
  </code></pre>