The Computer Oracle

How can I see the name of a process owner from the OSX prompt?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: RPG Blues Looping

--

Chapters
00:00 How Can I See The Name Of A Process Owner From The Osx Prompt?
00:21 Accepted Answer Score 11
00:52 Answer 2 Score 4
01:51 Thank you

--

Full question
https://superuser.com/questions/359002/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#macos #process

#avk47



ACCEPTED ANSWER

Score 11


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.




ANSWER 2

Score 4


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.