Tricks with ps
Process time and excluding particular users:
$ ps -eo pid,cputime,user,args | egrep -v 'root|daemon|smmsp|ntp'
Parameter | Description | Comment |
---|
pid | process id | |
cputime | accumulated CPU time | hh:mm:ss |
user | who owns the process | |
args | command + arguments | long invocations get truncated |
An easy way to get ps to tell you what the size of a target process:
$ ps -eo pid,size,rss,vsz,pmem,args | grep process
Parameter | Description | Comment |
---|
size | memory size | in kilobytes |
rss | Resident Set Size | |
vsz | total VM size | in bytes |
pmem | percentage memory use | not really useful unless you are chasing a low memory situation |
When piping ps output, sometimes it gets truncated (for example, when we grep). To avoid: