How do I display user ID associated with a process?
Last Updated on Friday, 01 April 2011 18:21
Question:
command which displays the user who invoked the command?
Answer:
ps command will print any user ID associated with any process on the system. To see all processes currently running on a Linux system a "ps" command can be used. The most common options used by ps command are "aux":
Â
$ ps aux
The command above will display every process on the system and will include a following information:
- USER: effective user id of a process owner
- PID: associated process ID
- %CPU: CPU time utilization by a process
- %MEM: Memory ( RAM ) utilization by a process
- VSZ: virtual memory size of the process in KiB
- RSS: resident set size, the non-swapped physical memory that a task has used
- TTY: terminal associated with the process
- STAT: process state such as running or sleeping
- START: time when the command started
- TIME: cumulative CPU time
- COMMAND: the actual command that started this particular process
There may be many processes running on the system at any time. To narrow down our search we can output only processes associated with particular user:
$ ps -U root
To search for any particular process name we can combine ps command with grep:
$ ps aux | grep init root 1 0.0 0.0 2876 668 ? Ss Feb25 0:02 /sbin/init
















