I need to use command that shows all processes related to terminal. Ps -a looks good except that there is no username printed. This command prints:
PID TTY TIME CMD 26969 pts/34 0:00 man 27636 pts/2 0:00 awk 25215 pts/35 0:00 bash
I would like it to be similar to this:
PID TTY TIME CMD USER 26969 pts/34 0:00 man name 27636 pts/2 0:00 awk name 25215 pts/35 0:00 bash name
Columns order does not matter
Use:
ps a -o pid,tty,etime,cmd,user
From ps manual:
SIMPLE PROCESS SELECTION
a ... An alternate description is that this option causes ps to list all processes with a terminal (tty), or to list all processeswhen used together with the x option.
STANDARD FORMAT SPECIFIERS
Here are the different keywords that may be used to control the output format (e.g. with option -o) or to sort the selected processeswith the GNU-style --sort option.
For example: ps -eo pid,user,args --sort user
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With