Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 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.

share|improve this answer
up vote 3 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.