title: How to write a shell script that can get CPU usage on a linux server
body: <p>I want to know How to write a shell script that can get CPU usage from a linux server.</p>
  
  <p>I do know how to do it with ps and top on a linux pc. While the problem here is I need to submit my job using a shell script to a linux server.</p>
  
  <p>I tried</p>
  
  <pre><code>myjob
  ps ux U myname
  </code></pre>
  
  <p>It runs in sequence. So, I don't know the CPU usage of myjob. </p>
  
  <pre><code>myjob &amp;
  ps ux U myname
  </code></pre>
  
  <p>The &amp; sign just suspend myjob. Again, the whole purpose here is to know the CPU usage of myjob.</p>
  
  <p>Please let me know how to run the two line in parallel or there is some other way around.</p>
  
  <p>Thank you in advance.   </p>