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
The ps
command without options displays a static list of processes in the current shell only. With its many options the listing can be customized to include system processes, processes run by a particular user, and much more.
Complete this graded quiz in Canvas.
Use Bash job control to manage multiple processes that were started from the same terminal session.
[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 &
Adding an ampersand (&) after a command starts it in the background. The jobs
command shows jobs running in the background.
In this Guided Exercise you practice using job control to start, suspend, and move multiple processes to the background and foreground.
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 a software interrupt that is delivered to a process. The kill
command with the l
option lists the signals available.
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.
In this guided exercise you use signals to manage and stop processes.
The top
command displays resource-intensive processes and load average in real time. The display is refreshed every 3 seconds.
Load Average is a measure of how busy the CPU is.
[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.
Use the top
command to examine running processes and control them dynamically.
kill
, pkill
, and killall
commands send signals to control a process.top
, uptime
, or w
commands.Locate and manage processes that use the most resources on a system.
Thanks for watching. This is the end of the presentation.
Created on 17 February 2025 by Dennis Kibbe. Last modified on 9 June 2025 09:21:00 by DNK.
Keyboard Shortcuts
This slide presentation was created by B6Plus. The audio accompanying this presentation is AI-generated.