title: Determining each unique process owner on linux system
body: <p>As the title says, im trying to make a bash script which gets each unique process owner on the system and calculates the total number of processes owned by that user as well as the sum of memory for all processes owned by that user. I know that <code>ps aux</code> displays all the info that i need, but how would i get each unique owner and store it in a variable so that i can get the needed info per user?</p>
  
  <p>I was thinking to use <code>awk</code> to get the 1st column (username) and store the username in an <code>array</code>. I would use an <code>if</code> statement to check if the username is already in the array and if not, then add it. Except that i dont know how to use arrays in bash shell and this method doesnt seem like an effective way of doing it. Does anyone know of a more effective way of doing this?   </p>
  
  <p>Sample output</p>
  
  <pre><code>owner
  Num Procs: 2, Mem: 3100, Curr CPU: 0
  Hog: 00:00:00 sshd: owner@pts/16
  
  root
  Num Procs: 71, Mem: 52644, Curr CPU: 0
  Hog: 01:33:41 /usr/bin/X :0 -br -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7
  </code></pre>