Skip to content

ps - Process Status

Summary

The ps command displays information about active processes. It allows you to monitor and manage running programs on your system.

Introduction

The ps command, short for "process status," is a fundamental utility in Linux for monitoring and managing processes. It provides a snapshot of currently running processes, including their process IDs (PIDs), resource usage, and other relevant information. This command is invaluable for system administrators and developers who need to diagnose performance issues, identify resource hogs, or simply understand what's happening on their system.

Use case and Examples

Listing all processes for the current user

ps
This command displays processes owned by the current user in the current terminal. It shows information such as PID, TTY, STAT, TIME, and COMMAND.

Listing all processes on the system

ps -A
The -A option displays all processes running on the system, regardless of the user who owns them. This provides a comprehensive overview of system activity.

Listing processes with full command and user

ps -ef
The -ef options provide a full listing of processes. -e selects all processes and -f generates a full listing. The output includes the username, PID, PPID, CPU usage, start time, terminal, status, and the command with its arguments.

Listing processes with a specific user

ps -u username
Replace username with the actual username to display only processes owned by that user.

Displaying a process and its children as a tree

ps -axjf
This displays the relationship between processes in a tree-like format. -a selects all processes, -x includes processes without controlling terminals and -jf displays in tree format.

Commonly used flags

Flag Description Example
-A Select all processes. Identical to -e. ps -A
-e Select all processes. ps -e
-f Generate a full listing. ps -f
-u Select processes by effective user ID. ps -u username
-p Select processes by process ID (PID). ps -p 1234
-o Specify user-defined output format. Allows you to customize which columns are displayed. ps -o pid,user,comm
-aux Display all processes with user and memory usage information. This option is a combination of BSD-style options. ps aux
-l Display long format output ps -l
-j Jobs format ps -j


Share on Share on

Comments