After completing the work in this module you will be able to:
ps
and top
to list running programs.kill
and top
to manage processes.Determine status, resource use, and ownership of running programs on a system, to control them.
A process is a running instance of a program and consists of memory, scheduling for time on the CPU, and other system resources.
Each CPU core can run a single process at a time. The illusion of multitasking is maintained by quickly switching among processes.
Zombie processes should not be confused with orphan processes, a process that is still executing, but whose parent has died. When the parent dies, the orphaned child process is adopted by init. - Wikipedia.
Understanding process states can help in troubleshooting a system that is not performing as expected.
[student@workstation ~]$ ps PID TTY TIME CMD 10430 pts/1 00:00:00 bash 10458 pts/1 00:00:00 ps
When you type ps
by itself, it only shows processes in your current terminal session - which isn't very useful most of the time. However, ps
has many options that let you see all system processes, processes run by specific users, and much more detailed information.
Complete this graded quiz in Canvas.
Job control lets you run multiple commands from one terminal session. Only one job can accept your keyboard input at a time (the "foreground" job), but you can run additional jobs in the "background."
[student@workstation ~]$ ps PID TTY TIME CMD 2640 pts/1 00:00:00 bash 2672 pts/1 00:00:00 ps
Only a single job at a time can accept user input. A shell can run additional jobs in the background. The ps
command lists the jobs in the current shell.
[student@workstation ~]$ sleep 30 & [1] 2677 [student@workstation ~]$ jobs [1]+ Running sleep 30 &
When you add an ampersand (&) after a command, it starts running in the background immediately. The jobs
command shows jobs running in the background.
In this exercise, you'll practice using job control commands to manage multiple processes. You'll learn how to suspend running jobs, move them to the background, and bring them back to the foreground when needed.
Use commands to kill and communicate with processes, define the characteristics of a daemon process, and stop user sessions and processes.
[student@workstation ~$] kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM 16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP
A signal is like sending a message to a process. The kill
command can send different types of signals - use kill -l
to see all available signals. The default signal is SIGTERM (signal 15), which politely asks the process to clean up and exit.
The kill
command without an option sends the default SIGTERM (15) signal. This instructs the process to clean up temporary files and stop.
If the process doesn't respond to the SIGTERM (15) signal. The SIGKILL (9) signal will kill the process. It's the bullet through the head. It will be messy with temporary files and allocated memory left behind.
[user@host ~]$ killall firefox Terminated /usr/lib/firefox/firefox-bin Terminated /usr/lib/firefox/plugin-container
Some processes may have multiple threads such as Firefox. The killall command can terminate all threads with a single command.
[student@workstation ~]$ jobs [1]- Running sleep 30 & [2]+ Running sleep 60 &
[student@workstation ~]$ kill -SIGTERM %1 [1]- Terminated sleep 30
Here two instances of the sleep
command are running in the background. The kill
command is used with the job number (%1) to terminate the desired job.
This hands-on exercise will reinforce what you've learned about process signals. You'll practice sending different signals to processes and observing their behavior.
The top
command displays the most resource-intensive processes and updates every 3 seconds automatically. It also shows the load average, which measures how busy your CPU is. Load average is calculated based on how many CPU cores your system has.
Load average shows three numbers representing the average load one minute, five minutes, and 15 minutes ago. When load average exceeds the number of CPU cores, processes must wait for CPU time and the system feels sluggish. Use lscpu
to find out how many CPU cores your system has.
[user@host ~]$ uptime 15:29:03 up 14 min, 2 users, load average: 2.92, 4.48, 5.20
The average load or load average on a system is calculated using the number of cores a CPU has. When the load average is higher than the number of CPU cores some processes must wait to run on the CPU and the system will feel sluggish. Load average is measured one minute, five minutes, and 15 minutes ago.
[user@host ~]$ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4
[user@host ~]$ uptime 15:29:03 up 14 min, 2 users, load average: 2.92, 4.48, 5.20
To make sense of a system's load average you can use the lscpu
command to find the number of CPU cores.
The top
command updates every three seconds and shows much useful information about a system. In addition top
can terminate a run away process.
In this exercise, you'll learn to navigate the top
interface, interpret the information it displays, and use it to manage processes. You'll practice identifying resource-intensive processes and taking action when needed.
kill
, pkill
, and killall
commands send signals to control a process.top
, uptime
, or w
commands.Today you've learned to monitor running processes with ps
and top
, manage multiple jobs with background and foreground control, terminate processes safely using signals, and identify resource-intensive processes that might be causing performance issues.
This lab brings together everything we've learned - using ps, top, and process signals to identify problematic processes and take corrective action. You'll learn to spot processes using too much CPU, memory, or other resources.
Remember to practice these commands in your lab environment. The more comfortable you become with process management, the more confident you'll be as a Linux administrator. This is the end of the presentation.
Created on 17 February 2025 by Dennis Kibbe. Last modified on 16 July by DNK.
Keyboard Shortcuts
A process is simply a running program - when you double-click an application or type a command, Linux creates a process for it. Think of it like this: the program file is like a recipe, and the process is when you're actually cooking that recipe. Each process uses memory and needs time on the CPU to do its work. This slide presentation was created by B6Plus. The audio accompanying this presentation is AI-generated.