Home General TopicsLinux ps Command : Process States & Management

Linux ps Command : Process States & Management

by Bella
ps command

In Linux, everything running on the system is a process. Whether it’s a system service, background daemon, or user application, each runs in its own virtual address space.

Since Linux is a multitasking operating system, multiple processes run simultaneously. Understanding how to monitor and manage these processes is a core skill for Linux administrators.

This guide explains:

  • What a process is in Linux
  • Types of Linux processes
  • Process state codes (R, S, Z, D, T)
  • How to use the ps command
  • How to interpret ps aux output

What Is a Process in Linux?

A process is a running instance of a program.

When you execute a command, Linux:

  1. Allocates memory
  2. Assigns a Process ID (PID)
  3. Creates a virtual address space
  4. Schedules CPU time

Every active task in Linux – including system services operates as a process.

Types of Processes in Linux

Linux systems run several categories of processes:

1. Interactive Processes

  • Started from a terminal (shell)
  • Can run in foreground or background
  • Controlled by the user

Example:

firefox &

2. Batch Processes

  • Not linked to a terminal
  • Executed automatically from a queue
  • Often scheduled via cron

3. Daemon Processes

  • Background services
  • Start during system boot
  • Run continuously

Examples:

  • sshd
  • cron
  • systemd

Daemons typically have no associated terminal (TTY shows ?).

Linux Process States (STAT Codes Explained)

When using the ps command, the STAT column shows process state codes.

CodeMeaning
RRunning or ready to run
SInterruptible sleep (waiting for event)
DUninterruptible sleep (usually I/O wait)
TStopped (job control or tracing)
ZZombie (defunct process)
XDead (rarely seen)

Key States Explained

R – Running

The process is currently executing or ready for CPU scheduling.

S – Sleeping

The process is idle, waiting for an event or signal.

D – Uninterruptible Sleep

Usually waiting on disk I/O. Cannot be interrupted by signals.

Z – Zombie Process

The process has finished execution but still exists in the process table because its parent hasn’t collected its exit status.

Understanding the Linux ps Command

The ps (process status) command displays information about active processes.

Basic Usage

ps

Shows processes associated with the current terminal session.

View All Processes

ps aux

This is the most commonly used form.

Understanding ps aux Output

Example:

ps aux

Output columns include:

ColumnDescription
USERProcess owner
PIDProcess ID
%CPUCPU usage
%MEMMemory usage
VSZVirtual memory size
RSSResident memory size
TTYTerminal associated
STATProcess state
STARTStart time
TIMECPU time consumed
COMMANDExecuted command

What Is a PID?

A PID (Process ID) is a unique number assigned to each process.

  • Starts at 1 (usually init or systemd)
  • Increments sequentially
  • Reused after reaching system limit

To terminate a process:

kill PID

Example:

kill 1234

Understanding TTY Column

  • Displays terminal from which process started
  • ? indicates daemon/background process
  • Useful for identifying interactive sessions

What Is CPU TIME in ps Output?

The TIME column shows:

Total CPU time used by the process

 This is NOT the total runtime duration – only CPU usage time.

Login Shell Identification

Login shells often appear with a hyphen:

Example:

-bash

This indicates the original login shell.

Additional shells started afterward will not have the hyphen.

Common Linux Process Management Commands

CommandPurpose
psView running processes
topReal-time process monitoring
htopEnhanced process viewer
killTerminate process
kill -9Force kill process
niceSet process priority
reniceModify priority of running process

When to Use ps Command

System administrators use ps to:

  • Identify high CPU processes
  • Detect zombie processes
  • Monitor daemon activity
  • Troubleshoot stuck tasks
  • Investigate system performance

Summary

The Linux ps command is a fundamental tool for:

  • Monitoring running processes
  • Understanding process states
  • Managing system resources
  • Troubleshooting performance issues

By understanding PID, STAT codes, and process types, administrators can efficiently manage Linux systems.

If you’re managing production Linux servers and need expert assistance with process management, performance tuning, or troubleshooting, professional Linux server support can help maintain system stability and uptime.

If you require help, contact SupportPRO Server Admin 

Partner with SupportPRO for 24/7 proactive cloud support that keeps your business secure, scalable, and ahead of the curve.

Contact Us today!
guy server checkup

You may also like

Leave a Comment