DevOpsLesson
DevOpsLesson

Free, comprehensive DevOps tutorials and learning roadmaps. Master Docker, Kubernetes, CI/CD, and more.

Stay Updated

Get notified about new tutorials and features.

Tutorials

  • What is DevOps?
  • Docker Tutorial
  • Terraform Tutorial
  • CI/CD Pipeline
  • All Tutorials

Roadmaps

  • DevOps Engineer
  • Cloud Engineer
  • SRE Path
  • All Roadmaps

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 DevOpsLesson. All rights reserved.

DOCKERKUBERNETESTERRAFORMAWSCI/CDLINUXGITDEVOPS ROADMAPCLOUD ROADMAPSRE ROADMAPGIT CHEATSHEETDOCKER CHEATSHEETK8S CHEATSHEETTF CHEATSHEETLINUX CHEATSHEETDOCKERFILE LINTERYAML VALIDATORCRON PARSERREGEX TESTER

Linux Tutorial

Introduction to Linux
Linux Filesystem
Linux Navigation
Linux File Operations
Linux Text Processing
Linux Permissions
Linux Users and Groups
Linux Process Management
Linux systemd Basics
Linux Networking
Linux Disk and Storage
Linux Bash Scripting
Linux Package Management
Linux Environment Variables
Linux Cron Jobs
Linux SSH Keys
Linux Firewall Basics
Linux Log Management
Linux Performance Monitoring and Troubleshooting

Linux Process Management

PreviousPrev
Next

Learn how to inspect, prioritize, background, and control processes in Linux using ps, top, kill, jobs, nohup, and related tools.

What Is a Process?

A process is a running instance of a program. When you open a shell, start a web server, or run a script, Linux creates processes to do that work.

Process management is a core Linux skill because troubleshooting often comes down to answering questions like:

  • what is running?
  • who started it?
  • how much CPU or memory is it using?
  • is it stuck?
  • how can I stop it safely?

Listing Processes with ps

The ps command shows process snapshots.

ps
ps aux
ps -ef

Commonly used forms:

  • ps aux shows a broad list with CPU, memory, and command info
  • ps -ef shows parent-child relationships and full commands in a format many admins like

Example:

ps aux | grep nginx

This helps you see running Nginx processes.

Watching Processes Live with top and htop

top shows a live updating view of system activity.

top

You can inspect CPU usage, memory consumption, load, and the busiest processes.

htop provides a friendlier interactive view if installed.

htop

Many servers do not include htop by default, so you should know top first.

Tip: top is usually available everywhere, which makes it a dependable first troubleshooting tool.

Stopping Processes with kill

Every process has a PID or process ID. Use kill to send signals to it.

kill 1234
kill -15 1234
kill -9 1234

Common signals:

  • 15 or SIGTERM: polite request to stop
  • 9 or SIGKILL: forceful termination

Prefer SIGTERM first so the process has a chance to clean up.

Note: SIGKILL cannot be ignored, but it also does not let the process shut down gracefully.

Process Priority with nice and renice

Linux lets you influence scheduling priority with nice values. Lower nice values mean higher priority; higher nice values mean lower priority.

Start a command with a custom nice value:

nice -n 10 backup-script.sh

Change an existing process:

renice 5 -p 1234

This is useful when you want background jobs to be less disruptive to interactive or production workloads.

Jobs, Backgrounding, and Foreground Control

In a shell session, you can manage jobs directly.

Start a process in the background:

long-running-command &

List shell jobs:

jobs

Move a stopped job to the background:

bg %1

Bring a job to the foreground:

fg %1

This is useful during interactive work when you want to keep a task running without blocking your terminal.

Keeping Processes Alive with nohup

Normally, a process tied to your shell may stop when you disconnect. nohup helps keep it alive.

nohup ./sync-data.sh > sync.log 2>&1 &

This is handy for long-running tasks over SSH.

nohup ignores the hangup signal and, combined with &, lets the command continue in the background.

Process States

Linux processes can exist in different states. You may see letters like these in process listings:

  • R = running or runnable
  • S = sleeping
  • D = uninterruptible sleep, often waiting on I/O
  • T = stopped
  • Z = zombie

A zombie process has finished execution but still has an entry because its parent has not collected its exit status yet.

A Practical Troubleshooting Example

Suppose an app is slow and users report timeouts.

A simple investigation could be:

top
ps aux | grep myapp
ps -ef | grep myapp

If one backup process is using too much CPU, you might lower its priority:

renice 15 -p 2481

If a worker is frozen and not responding to normal shutdown logic, you might send SIGTERM, then escalate if required:

kill 2481
kill -9 2481

Best Practices

  • inspect before killing
  • prefer graceful signals first
  • use top to understand the system before acting
  • background carefully and know which jobs belong to your shell
  • use nohup when disconnects would otherwise stop important tasks

Test Your Understanding

Let's see how well you understood the concepts! These exercises will help reinforce what you just learned.

Exercise 1: Choosing the first stop signal

Question: When a process is misbehaving, which signal should you normally try before using SIGKILL?

Exercise

Exercise 1: Choosing the first stop signal

Select the normal graceful signal for asking a process to exit.

Exercise 2: Tracking background jobs

Question: What does the jobs command show?

Exercise

Exercise 2: Tracking background jobs

Identify what scope of work the jobs command reports.

Exercise 3: Surviving shell disconnects

Scenario: You launch a long sync over SSH and do not want it to die when your terminal closes.

Question: Why is nohup ./sync-data.sh > sync.log 2>&1 & useful here?

Exercise

Exercise 3: Surviving shell disconnects

Choose what nohup plus backgrounding accomplishes for a long-running command.

PreviousPrev
Next

Continue Learning

Linux Text Processing

Learn how to search, filter, transform, and count text in Linux using grep, awk, sed, cut, sort, uniq, wc, and pipes.

20 min·Medium

Linux Permissions

Understand Linux ownership, rwx permissions, octal notation, chmod, chown, special bits, and umask.

18 min·Medium

Linux Users and Groups

Learn how Linux accounts and groups work, and how to manage users, passwords, sudo access, and account files.

15 min·Medium

Explore Related Topics

Do

Docker Tutorials

Run and manage containers on Linux

Gi

Git Tutorials

Master Git version control on the command line

Try the Tool

Cron Parser

Parse and validate cron expressions with a visual schedule preview.

Regex Tester

Test and debug regular expressions used in Bash scripts and configs.

On This Page

What Is a Process?Listing Processes with `ps`Watching Processes Live with `top` and `htop`Stopping Processes with `kill`Process Priority with `nice` and `renice`Jobs, Backgrounding, and Foreground ControlKeeping Processes Alive with `nohup`Process StatesA Practical Troubleshooting ExampleBest PracticesTest Your UnderstandingExercise 1: Choosing the first stop signalExercise 2: Tracking background jobsExercise 3: Surviving shell disconnects