Red Hat Certified Systems Admin (RHCSA) EX200 Practice Exam

Access More Questions
Which command lists processes owned by a given user with their PIDs and names?
Correct Answer:
pgrep -u -l
Explanation:
Listing processes owned by a specific user with their PIDs and names is best done with a tool that filters the process table by owner and can show the PID alongside the process name. The command pgrep -u -l does exactly that: -u restricts the results to processes owned by the given user, and -l prints the process name (the command name) together with the PID. This yields a straightforward list where each line contains the PID and the corresponding process name, which matches the requested output. Other commands aren’t as direct for this exact need. ps can show PIDs and names if you tailor the output (for example, ps -u -o pid,comm), but pgrep with -u and -l provides the concise, on-demand listing in a single command. Top is interactive and focused on real-time monitoring by default, and pkill is for signaling processes rather than listing them.

Access more questions from this quiz

Continue to Red Hat Certified Systems Admin (RHCSA) EX200 Practice Exam for more practice questions and the full quiz experience.

Access More Questions