How can I see the name of a process owner from the OSX prompt?
Solution 1:
Use the -j
flag. For example, ps -j
, or combined with other flags, like ps -efj
.
The man page (man ps
) describes the -j
flag like this:
Print information associated with the following keywords: user, pid, ppid, pgid, sess, jobc, state, tt, time, and command.
The "user" part is the user name.
Solution 2:
Simple solution: use ps -ej
.
General solution: use ps -eo user,pid,tty,command
.
The ps
command lets you control what information (what columns) is displayed using the -o
option, e.g.
ps -o user,pid,%cpu,%mem,command
displays username, PID, recent CPU and memory usage and command for each process that is shown.
The -j
option displays user, pid, parent pid, process gid, session, job control count, state, control terminal name, accumulated CPU time, and command with arguments.
The -f
option displays uid, pid, parent pid, recent CPU usage, process start time, controling tty, elapsed CPU usage, and the associated command. Hence, there's probably no need to keep -f
with -j
or -o
.
See manpage for details.