Skip to content

Using the ps Command in the ChromeOS Linux Environment

The ps command in Linux is used to display information about currently running processes. It provides details such as process IDs (PIDs), CPU and memory usage, and command execution details. This guide covers how to effectively use ps in the ChromeOS Linux (Crostini) environment.

Basic Usage

Listing Processes for the Current User

To display processes for the current user:

bash ps

This shows a simple list of running processes started by the user in the current shell.

Displaying All Running Processes

To see all processes running on the system:

bash ps aux

Explanation of columns: - USER – User who owns the process - PID – Process ID - %CPU – CPU usage percentage - %MEM – Memory usage percentage - VSZ – Virtual memory size - RSS – Resident memory size - TTY – Terminal associated with the process - STAT – Process state - START – Time when the process started - TIME – Total CPU time used - COMMAND – Command that launched the process

Filtering Processes by Name

To find a specific process by name:

bash ps aux | grep process_name

For example, to find all running Chrome processes:

bash ps aux | grep chrome

Displaying a Process Tree

To view running processes in a tree format:

bash ps axjf

Displaying Processes for a Specific User

To list all processes owned by a specific user:

bash ps -u username

Displaying Process IDs Only

To get a list of PIDs for a specific process:

bash ps -C process_name -o pid=

For example, to get the PID of bash:

bash ps -C bash -o pid=

Practical Use Cases

  • Checking system resource usage: bash ps aux --sort=-%cpu | head
  • Finding and terminating a process: bash kill $(ps -C process_name -o pid=)
  • Monitoring processes in real time: bash watch "ps aux --sort=-%mem | head"

Conclusion

The ps command is an essential tool for monitoring system processes in the ChromeOS Linux environment. Whether checking running processes, filtering specific ones, or managing system resources, ps provides valuable insights into system activity.