DEV Community

Cover image for Mastering Linux Processes: From Beginner to Advanced Guide
Khaled Md Saifullah
Khaled Md Saifullah

Posted on

Mastering Linux Processes: From Beginner to Advanced Guide

If you have ever worked with Linux, you have probably heard the term “process”. But what exactly is a Linux process, how does it work and why is it so important for system administration, performance and security?

In this blog, I will dive into Linux processes step by step starting from the basics and moving towards advanced concepts. Whether you are a beginner exploring Linux for the first time or an experienced sysadmin, this post will level up your understanding.

What is a Process in Linux?

A process in Linux is simply a program in execution.

Whenever you run a command or application, Linux creates a process for it.

Example:

$ firefox
Enter fullscreen mode Exit fullscreen mode

When you run this command, Linux creates a new process for Firefox.

Each process is assigned a Process ID (PID) which makes it uniquely identifiable.

Key Components of a Process

  • PID (Process ID) → Unique number to identify each process.
  • PPID (Parent Process ID) → The process that started (parent) the current process.
  • UID (User ID) → The owner of the process.
  • Priority & Scheduling → Determines how CPU time is shared.
  • State → Running, Sleeping, Stopped, or Zombie.

👉 You can check running processes with

ps aux
Enter fullscreen mode Exit fullscreen mode

Types of Linux Processes

  1. Foreground Process → Runs interactively (nano, top)
  2. Background Process → Runs silently in the background
  3. Daemon Process → System services like sshd, cron
  4. Zombie Process → Dead process not cleared by its parent
  5. Orphan Process → Parent terminated, but child is still running

Essential Commands to Manage Processes

Here are the most commonly used process management commands in Linux:

Command Description
ps Displays active processes
top Real-time process monitoring
htop Advanced version of top (interactive)
kill <PID> Terminates a process by PID
killall <name> Kills processes by name
nice Starts a process with a priority
renice Changes priority of running processes
jobs Lists background jobs
fg %1 Brings job to foreground
bg %1 Resumes job in background

Monitoring Processes Like a Pro

Linux provides tools to monitor and optimize processes:

  • top → CPU & memory usage in real time
  • htop → Colorful, user friendly monitoring
  • atop → Detailed performance analysis
  • systemctl → Manage daemon processes

Example

htop
Enter fullscreen mode Exit fullscreen mode

This will show you interactive process stats with CPU, memory, and more.

Advanced Topics in Linux Processes

1️⃣ Process States

  • Running (R) → Currently active
  • Sleeping (S) → Waiting for resources
  • Stopped (T) → Halted process
  • Zombie (Z) → Process finished but still in process table

2️⃣ Signals

Linux uses signals to control processes.

Common signals:

  • SIGTERM (15) → Graceful stop
  • SIGKILL (9) → Force kill (can’t be ignored)
  • SIGSTOP (19) → Pause process
  • SIGCONT (18) → Resume process
kill -9 1234
Enter fullscreen mode Exit fullscreen mode

Note: This kills the process with PID 1234.

3️⃣ Process Priorities (Nice & Renice)

Every process has a priority (niceness value) from - 20 (highest) to 19 (lowest).

nice -n 10 myscript.sh
renice -n -5 -p 2345
Enter fullscreen mode Exit fullscreen mode

4️⃣ Process Scheduling

Linux uses schedulers (CFS, Deadline, RT) to decide which process gets CPU time.

Practical Example: Running a Background Process

# Run a script in the background
./backup.sh &

# Check jobs
jobs

# Bring process to foreground
fg %1
Enter fullscreen mode Exit fullscreen mode

This is commonly used for long running scripts like backups, servers and cron jobs.

Security & Process Management

Always check suspicious processes using:

ps aux | grep suspicious
Enter fullscreen mode Exit fullscreen mode
  • Use top/htop to detect high CPU/memory usage.
  • Restrict permissions so untrusted users can not run malicious processes.
  • Automate process monitoring with cron jobs or tools like Monit.

Conclusion

Linux processes are the backbone of system performance.
From understanding basic commands to mastering advanced scheduling and signals, process management is a skill every developer, sysadmin and DevOps engineer must have.

By learning how to monitor, control and optimize processes, you can ensure your Linux system runs efficiently, securely and reliably.

If you found this helpful, follow me for more Linux, DevOps and MERN stack tutorials. 🚀

Top comments (0)