bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
Learn/Bash/System Monitoring
Bash•System Monitoring

Bash ps Command - Snapshot of Current Processes

Using the ps Command

The ps command is used to report a snapshot of current processes.

It's a useful tool for monitoring and managing processes on your system.

All examples below use a hypothetical process list for demonstration:

PID TTY TIME CMD
1234 pts/0 00:00:01 bash
5678 pts/1 00:00:02 python
9101 pts/2 00:00:03 node

Understanding the Output

The ps command output consists of several columns, each representing different aspects of the system's processes:

  • PID : Process ID, a unique identifier for each process.
  • TTY : Terminal type associated with the process.
  • TIME : Total CPU time used by the process.
  • CMD : The command that started the process.

Basic Usage

To display a snapshot of current processes, use ps :

Example: Basic Usage

ps
PID TTY TIME CMD
1234 pts/0 00:00:01 bash
5678 pts/1 00:00:02 python
9101 pts/2 00:00:03 node

Options

The ps command has options to change how it works:

  • -e - Show all processes
  • -f - Show detailed information
  • -u - Show processes for a specific user
  • -a - Show all processes with a terminal
  • -x - Show processes without a terminal

Show All Processes

The -e option allows you to show all processes.

Example: Show All Processes

ps -e
PID TTY TIME CMD
1234 pts/0 00:00:01 bash
5678 pts/1 00:00:02 python
9101 pts/2 00:00:03 node

Show Detailed Information

The -f option allows you to show detailed information.

Example: Show Detailed Information

ps -f
UID PID PPID C STIME TTY TIME CMD
user 1234 1 0 08:00 pts/0 00:00:01 bash
user 5678 1234 0 08:01 pts/1 00:00:02 python
user 9101 5678 0 08:02 pts/2 00:00:03 node

Show Processes for a Specific User

The -u option allows you to show processes for a specific user.

Example: Show Processes for a Specific User

ps -u user
PID TTY TIME CMD
1234 pts/0 00:00:01 bash
5678 pts/1 00:00:02 python

Show Processes with a Terminal

The -a option allows you to show all processes with a terminal.

Example: Show Processes with a Terminal

ps -a
PID TTY TIME CMD
1234 pts/0 00:00:01 bash
5678 pts/1 00:00:02 python

Show Processes without a Terminal

The -x option allows you to show processes without a terminal.

Example: Show Processes without a Terminal

ps -x
PID TTY TIME CMD
9101 ? 00:00:03 node

Combining Options

Options can be combined to provide more detailed output. For example, ps -ef shows all processes with detailed information.

Example: Combine Options

ps -ef
UID PID PPID C STIME TTY TIME CMD
user 1234 1 0 08:00 pts/0 00:00:01 bash
user 5678 1234 0 08:01 pts/1 00:00:02 python
user 9101 5678 0 08:02 pts/2 00:00:03 node

Chapter

Back to System Monitoring

Next

Bash top Command - Display Linux Tasks

This chapter

Overview
7

Lessons

23m

Read time

1. Bash ps Command - Snapshot of Current Processes2. Bash top Command - Display Linux Tasks3. Bash df Command - File System Disk Space Usage4. Bash du Command - File Space Usage5. Bash free Command - Display Free and Used Memory6. Bash kill Command - Terminate Processes7. Bash uptime Command - System Runtime

On this page

Using the ps CommandUnderstanding the OutputBasic UsageExample: Basic UsageOptionsShow All ProcessesExample: Show All ProcessesShow Detailed InformationExample: Show Detailed InformationShow Processes for a Specific UserExample: Show Processes for a Specific UserShow Processes with a TerminalExample: Show Processes with a TerminalShow Processes without a TerminalExample: Show Processes without a TerminalCombining OptionsExample: Combine Options