In Unix/Linux system administration, which command is used to display the characteristics and current status of running processes (for example, PID, TTY, CPU time, and the command)?
-
Aps
-
Bpid
-
Cdu
-
Dau
-
ENone of the above
Answer
Correct Answer: ps
Explanation
Introduction / Context:Being able to view process characteristics is essential for Unix/Linux troubleshooting and performance tuning. Administrators and developers rely on a standard tool to see a snapshot of running processes, including process IDs, controlling terminals, resource usage, parent relationships, and the command that launched each process.
Given Data / Assumptions:
- You are using a Unix-like shell such as bash or zsh.
- You wish to inspect live process information like PID, TTY, CPU time, and command.
- No third-party utilities are assumed; only core system tools.
Concept / Approach:The command 'ps' (process status) prints process attributes in various formats. Common invocations include 'ps aux' (BSD style) to list all processes system-wide and 'ps -ef' (SysV style) for a full-format listing. Options like '-o' allow custom column selection, while filters such as '-u user' or a specific PID restrict the output to what you need.
Step-by-Step Solution:
List your terminal's processes: psShow all processes: ps auxSysV-style full listing: ps -efCustom columns (PID and command): ps -eo pid,cmdFilter by user: ps -u usernameVerification / Alternative check:Cross-check PIDs reported by 'ps' with corresponding entries under '/proc/
Why Other Options Are Wrong:
- pid: This is a process identifier concept, not a listing command.
- du: Reports disk usage; unrelated to process inspection.
- au: Not a standard command for process display.
- None of the above: Incorrect because 'ps' is precisely the required tool.
Common Pitfalls:Mixing BSD and SysV option styles (some flags differ), assuming 'ps' auto-updates (it does not; it is a snapshot), or forgetting to elevate privileges when listing processes owned by other users and expecting complete results.
Final Answer:ps