Howto psacct – sa

In continuation to the previous article on “Howto psacct” and “Find / Detect Command History for users“, we are here with a Howto psacct – sa

sa – Summarize accounting information

The sa command can be used to summarize the information about the commands executed previously. It condenses this data into a file named savacct which contains the number of times the command was executed and the system resources used. Moreover the sa command can be used to summarize the information per-user basis. This information is saved in the file named usracct.

[[email protected] ~]# sa

Output:

     245     257.42re       1.80cp         0avio      6667k
      23     241.10re       1.57cp         0avio      3557k   ***other*
       3       1.44re       0.12cp         0avio     43675k   soffice.bin
       2       0.08re       0.06cp         0avio       445k   foo2zjs
       4       0.08re       0.02cp         0avio      4203k   gs
       3       0.04re       0.01cp         0avio      6121k   javaldx
       6       0.02re       0.01cp         0avio    164373k   java
       6       0.08re       0.01cp         0avio       734k   cat

The output is explained taking the example of a line in the above output:

       6       0.08re       0.01cp         0avio       734k   cat

here,

    * 0.08re "real time" in wall clock minutes
    * 0.01cp sum of system and user time in cpu minutes
    * 734k cpu-time averaged core usage, in 1k units
    * cat command name

Howto psacct – sa – Display the output in per-user basis

You can use this command to display the output in per-user basis. The following is the command:

[[email protected] ~]# sa -u

Output:

root       0.00 cpu      392k mem      0 io accton          
root       0.00 cpu      443k mem      0 io acct            
root       0.00 cpu      443k mem      0 io invoke-rc.d     
root       0.00 cpu      443k mem      0 io acct.postinst   
root       0.13 cpu     2033k mem      0 io dpkg            
root       0.00 cpu      765k mem      0 io touch           
root       0.00 cpu      443k mem      0 io sh              
root       0.00 cpu     5032k mem      0 io apt-get         *
root       0.78 cpu     1341k mem      0 io apt-get         
gagan      1.62 cpu     1850k mem      0 io apt-check       
root       0.00 cpu      443k mem      0 io acct            
root       0.00 cpu      443k mem      0 io acct            
root       0.00 cpu      427k mem      0 io ac              
postgres   0.00 cpu    10466k mem      0 io postgres        *

Howto psacct – sa – Display the number of processes and number of CPU minutes on a per-user basis

To display the number of processes and number of CPU minutes on a per-user basis, use the following:

[[email protected] ~]# sa -m

Output:

root                                   44     231.51re       0.86cp         0avio      1515k
smmsp                                  28      11.04re       0.68cp         0avio       517k
gagan                                 124      13.63re       0.17cp         0avio     11038k
lp                                     56       1.24re       0.09cp         0avio      1125k
postgres                               25       0.00re       0.00cp         0avio     10466k

No Comments

Post a Comment

Time limit is exhausted. Please reload CAPTCHA.