Junior — Middle
Can you explain the purpose and how the 'ps' command works in an operating system?
sobes.tech AI
Answer from AI
The ps command in Unix/Linux operating systems is used to display a list of running processes. It allows you to see information about processes, such as their identifiers (PID), status, runtime, resources used, and the command that started them.
How it works: ps reads data from the system process tables and displays it in a human-readable format. It is often used with options, for example:
ps aux— shows all processes of all users with detailed information.ps -ef— an alternative output format.
Example:
$ ps aux | grep python
user 1234 0.0 1.2 23456 1234 pts/0 S+ 10:00 0:00 python script.py
Here, it shows that a Python process with PID 1234 is running.