Post

Process 101 on Linux

My personal notes on Linux process management, including PIDs, signals, systemd, systemctl, and foreground/background jobs.

Process 101 on Linux

Today I revised Linux process management and wrote this note so I can quickly review it later.

Managing processes in Linux feels like conducting an orchestra. Every running program is a process, and Linux gives me clear tools to monitor, control, and organize them.

1. Tracking Process IDs (PIDs)

Each process gets a unique Process ID (PID) when it starts.

  • PID 1 is usually systemd on modern Linux systems.
  • New processes get new PIDs as they are created.

Commands I should remember:

1
ps

Shows a snapshot of processes in the current shell session.

1
ps aux

Shows almost all running processes across the system.

1
top

Live, real-time process monitor for CPU and memory usage.

2. Managing the Life of a Process (Signals)

If a process hangs or needs control, I can send a signal using its PID.

1
kill PID

Default signal is SIGTERM. This is the polite way to ask a process to stop.

1
kill -9 PID

Sends SIGKILL. This forcefully stops a process immediately.

1
kill -STOP PID

Pauses a running process.

1
kill -CONT PID

Resumes a paused process.

My rule: try SIGTERM first, use SIGKILL only when needed.

3. How Processes Are Organized (systemd, Parent/Child, Namespaces)

On most Linux distributions, systemd starts first and acts as the main parent process.

  • Services and apps become child processes in a process tree.
  • I can inspect this structure with commands like pstree.

Quick note on namespaces:

  • Namespaces help isolate processes so one group cannot easily interfere with another.
  • This is a key idea behind containers.

4. Service Automation with systemctl

For long-running services (like web servers), I should use systemctl.

CommandWhat it does
systemctl start SERVICEStarts the service now
systemctl stop SERVICEStops the service now
systemctl restart SERVICERestarts the service
systemctl enable SERVICEStarts service automatically at boot
systemctl disable SERVICEStops auto-start at boot
systemctl status SERVICEShows current status and recent logs

Example:

1
systemctl status apache2

5. Foreground vs Background Jobs

Linux terminal jobs can run in two ways:

  • Foreground: command takes over the terminal.
  • Background: command runs while I keep using the terminal.

Useful job control shortcuts:

1
long_command &

Starts a command directly in background.

1
Ctrl + Z

Suspends the current foreground job.

1
bg

Continues a suspended job in background.

1
fg

Brings a background/suspended job back to foreground.

1
jobs

Lists current jobs in this shell.

Quick Revision Table

If I want to…Use this
See running processesps aux or top
Stop a stuck process politelykill PID
Force stop a processkill -9 PID
Pause and resume a processkill -STOP PID and kill -CONT PID
Start a service nowsystemctl start SERVICE
Start a service on bootsystemctl enable SERVICE
Suspend current taskCtrl + Z
Resume in backgroundbg
Bring task back to focusfg

What I Learned Today

  • Every program is a process with a PID.
  • Signals are the safest way to control process behavior.
  • systemd and systemctl are central for service management.
  • Job control (Ctrl + Z, bg, fg) is very useful for terminal multitasking.

This is one of those Linux fundamentals I need to stay sharp on for both system administration and security work.

This post is licensed under CC BY 4.0 by the author.