Skip to content
Linuxinfra.com
Menu
  • Home
  • Linux Security
  • Linux Administration
    • Linux History
    • Why Linux is Better?
    • What Are Linux Distributions?
    • Linux kernel and shell
    • Processes in Linux/Unix
    • Linux Basic Commands
  • Cyber Security
    • PCI DSS
      • Module 1: Introduction to PCI DSS
      • Module 2: PCI DSS Requirements Overview
      • Module 3: Scope of PCI DSS Compliance
      • Module 4: Risk Management and Vulnerability Assessments
      • Module 5: Implementing and Maintaining PCI DSS
      • Module 6: Compliance Validation and Reporting
      • Module 7: Best Practices and Case Studies for PCI DSS
      • Module 8: Updates and Future of PCI DSS
Menu

Processes in Linux/Unix

Posted on January 4, 2025

In Linux/Unix, every running program or command is driven by a process, acting as the core of system operations. Whether you’re coding in a text editor, executing a complex script, or surfing the web, processes make it all possible. Understanding the basics of processes is essential for effectively managing your Linux/Unix system and harnessing its full capabilities.

This guide explains what processes are, how they work, and the tools you can use to manage them.

Table of Contents

  1. What is a Process?
  2. Types of Processes in Linux/Unix
  3. Life Cycle of a Process
  4. Key Terms to Know
  5. Process Management Commands
  6. Signals in Linux/Unix
  7. Example: Managing Processes
  8. Conclusion

What is a Process?

A process is a program in execution. It has:

  1. Program Code: The instructions to run.
  2. Runtime Data: Temporary data used while running.

For example, when you open a text editor, a process is created to manage its execution.

Types of Processes in Linux/Unix

  1. Foreground Processes
    • Run in the terminal and take user input.
    • Example: Opening a text editor like nano.
  2. Background Processes
    • Run in the background, independent of user input.
    • Example: System updates or daemons like cron.
  3. Daemon Processes
    • Special background processes that start during system boot.
    • Example: httpd (web server process).
  4. Zombie Processes
    • Processes that have finished execution but still occupy a slot in the process table.
  5. Orphan Processes
    • Processes whose parent has terminated.

Life Cycle of a Process

A process in Linux/Unix has a life cycle with the following stages:

  1. Created: The process is created with a unique Process ID (PID).
  2. Ready: It’s waiting for CPU time to execute.
  3. Running: Actively using the CPU.
  4. Terminated: The process has finished or been stopped.

Key Terms to Know

  • PID (Process ID): A unique number assigned to each process.
  • Parent Process: A process that creates another process.
  • Child Process: A process created by a parent process.
  • PPID (Parent Process ID): The PID of a parent process.

Process Management Commands

  1. Viewing Processes
    • ps: Lists active processes.
    • top: Displays real-time process information.
    • htop: A more user-friendly version of top.
  2. Killing Processes
    • kill [PID]: Stops a process using its PID.
    • killall [name]: Stops all processes with a specific name.
  3. Running Processes in Background
    • Add & after a command.
Process

4. Bringing Background Processes to Foreground

  • fg: Resumes a background process in the foreground.

Changing Process Priority

  • nice -n [priority] [command]: Starts a process with a priority.
  • renice [priority] [PID]: Changes the priority of an existing process.

Signals in Linux/Unix

Signals are ways to communicate with processes. Common signals:

  • SIGKILL: Forcefully stops a process.
  • SIGTERM: Politely asks a process to stop.
  • SIGSTOP: Pauses a process.
  • SIGCONT: Resumes a paused process.

Example of sending a signal:

kill -SIGKILL [PID]

Example: Managing a Background Process

  1. Check its PID:

Stop the process:

Conclusion

Processes are at the core of Linux/Unix operations. By understanding how to view, manage, and terminate processes, you can keep your system running smoothly. Tools like ps, top, and kill are your go-to helpers for mastering process management.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

cloud infrastructure community support customizability data protection developer tools free software hardware support lightweight Linux Linux applications Linux command line Linux Community Linux community support Linux development Linux Distributions Linux for old hardware Linux for servers Linux graphical interface Linux installation Linux Kernel Linux package manager Linux performance Linux rolling release linux security Linux security tools Linux server Linux software Linux support Linux terminal Linux updates multitasking multiuser networking no bloatware open-source performance privacy privacy control programming scalability secure OS security software repository stability system resources

  • January 2025
  • November 2024
  • September 2024
  • August 2024
  • March 2024
  • January 2024
  • December 2023
©2025 Linuxinfra.com | Design: Newspaperly WordPress Theme