Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I run ps -ef in the OSX terminal, the list of processes includes the UID - the numerical user id of the process owner. How can I see the name of the process owner?

share|improve this question
up vote 6 down vote accepted

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.

share|improve this answer
    
ef is optional – j also works without. – Daniel Beck Nov 18 '11 at 19:23
    
@DanielBeck - answer updated to clarify. – Nathan Long Nov 18 '11 at 19:31

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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .