Options
-e show all proccesses
-f full description
-F extra full
-u user list only processes belonging to user
–forest lists processes as a tree structure
-T show the threads with SPID
-L show the threads with LWP/NLWP columns
-C list by command name
r restricts to only running processes
e shows the environment after the command
Process state codes
D Uninterruptible sleep (usually IO)
R Running or runnable (on run queue)
S Interruptible sleep (waiting for an event to complete)
T Stopped, either by a job control signal or because it is being traced.
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z Defunct (“zombie”) process, terminated but not reaped by its parent
Example:
ps -Lu mysql -o tid,state,%cpu,%mem,etime,nlwp,comm,sgi_p
The above lists all mysql threads with these columns: thread id, state of the process (short description; for long use stat), cpu percentage usage (per thread), memory percentage usage (shared), elapsed time, number of lightweight processes (threads), name of the command and the number of the used CPU / core with * if the process is sleeping.