A process is simply a program that is currently running on your system. Whenever you execute a command in Linux, the operating system creates a process to run that command.
- Whenever a command is issued in Unix/Linux, it creates/starts a new process. For example, pwd when issued which is used to list the current directory location the user is in, a process starts.
- Through a 5 digit ID number Unix/Linux keeps an account of the processes, this number is called process ID or PID. Each process in the system has a unique PID.
- Used up pid’s can be used in again for a newer process since all the possible combinations are used.
- At any point of time, no two processes with the same pid exist in the system because it is the pid that Unix uses to track each process.
Example:
pwdOutput:

When you run this command, Linux starts a process to execute pwd, displays the output, and then ends the process.
Process ID (PID)
Every process in Linux is assigned a unique number called a Process ID (PID).
- PID helps the system track and manage processes
- No two running processes can have the same PID at the same time
- Once a process ends, its PID may be reused late
How a Process Runs
A process can be run in two ways:
Method 1: Foreground Process
Every process when started runs in foreground by default, receives input from the keyboard, and sends output to the screen.
- Runs in the terminal by default
- Blocks the terminal until it finishes
- Takes input from the keyboard
- Sends output to the screen
Example:
sleep 10You cannot run another command until this finishes.
Method 2: Background processes
It run independently of the terminal, allowing you to perform other tasks simultaneously.
- They do not require keyboard input while running.
- To start a process in the background, add
&at the end of the command.
Example:
sleep 60 &Output:
[1] 2456- 1 -> Job number
- 2456 -> Process ID (PID)
- Terminal is immediately free for other commands
Tracking ongoing processes
ps (Process status) can be used to see/list all the running processes.
ps

- For more information -f (full) can be used along with ps
$ ps –f
Output:

- For single-process information, ps along with process id is used
Command:
$ ps 19
Output:
PID TTY TIME CMD
19 pts/1 00:00:00 sh
For a running program (named process) Pidof finds the process id’s (pids)
Fields described by ps are described as:
- UID: User ID that this process belongs to (the person running it)
- PID: Process ID
- PPID: Parent process ID (the ID of the process that started it)
- C: CPU utilization of process
- STIME: Process start time
- TTY: Terminal type associated with the process
- TIME: CPU time is taken by the process
- CMD: The command that started this process
There are other options which can be used along with ps command :
- -a: Shows information about all users
- -x: Shows information about processes without terminals
- -u: Shows additional information like -f option
- -e: Displays extended information
Stopping a process:
When running in foreground, hitting Ctrl + c (interrupt character) will exit the command. For processes running in background kill command can be used if it’s pid is known.
Command:
$ ps –f
Output:
UID PID PPID C STIME TTY TIME CMD
52471 19 1 0 07:20 pts/1 00:00:00 sh
52471 25 19 0 08:04 pts/1 00:00:00 ps –f
Command:
$ kill 19Output:
TerminatedIf a process ignores a regular kill command, you can use kill -9 followed by the process ID.
Command:
$ kill -9 19Output:
TerminatedJob Control Commands
Job control commands allow you to manage running processes in the shell by starting them in the background, bringing them to the foreground, or suspending and resuming jobs interactively.
1. bg: Resume in Background
A job control command that resumes suspended jobs while keeping them running in the background
Syntax:
bg [ job ]
For example:
bg %192. fg: Bring to Foreground
It continues a stopped job by running it in the foreground.
Syntax:
fg [ %job_id ]For example:
fg 19Monitoring Processes in Real Time
Monitoring processes in real time allows you to observe CPU, memory, and process activity live, helping you quickly identify resource-heavy or problematic processes.
Using top Command
This command is used to show all the running processes within the working environment of Linux.
Syntax:
topOutput:

It Shows:
- CPU usage
- Memory usage
- Running processes (live)
Press q to exit.
Process Priority
Process priority determines how much CPU time a process receives, allowing the system to manage and balance resource usage efficiently among running processes.
1. nice
It starts a new process (job) and assigns it a priority (nice) value at the same time.
Syntax:
nice [-nice value]Example:
nice -n 10 sleep 60nice value ranges from -20 to 19, where -20 is of the highest priority.
- -20 -> Highest priority
- 19 -> Lowest priority
2. renice
To change the priority of an already running process renice is used.
Syntax:
renice [-nice value] [process id]Example:
renice 5 -p 2456Types of Processes
There are three types of Processes
1. Parent and Child process:
- Every process in Linux is created by another process, known as the parent process.
- The newly created process is called the child process.
- The
ps -fcommand displays the Process ID (PID) and the Parent Process ID (PPID) in its 2nd and 3rd columns. - Most user processes have the shell as their parent process.
2. Zombie and Orphan process:
- When a child process completes its execution, it sends a SIGCHLD signal to the parent process, informing it of the termination.
- If the parent process is terminated before the child finishes, the child becomes an orphan process.
- Orphan processes are then adopted by the init (PID 1) process.
- A zombie process is a process that has finished execution but still remains in the process table because its parent has not yet read its exit status.
- Zombie processes are essentially dead processes that occupy minimal system resources.
3. Daemon process:
- Daemon processes are background system processes that run continuously to provide services.
- They usually run with root privileges and handle requests from other processes.
- Common examples include the print daemon or web server daemons.
- Daemons do not have an associated terminal (TTY), when you run
ps -ef, processes with a ‘?’ in the TTY field are daemon processes.
Disk and Memory Commands (Related Utilities)
These commands help monitor system storage usage and memory consumption, which is essential for understanding resource availability and system performance.
1. df
It shows the amount of available disk space being used by file systems
Example:
dfOutput:

2. free
It shows the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.
Example:
freeOutput:
