1/54
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Process ID (PID)
A unique number to identify and manage processes.
Parent-Child ID (PPID)
Processes can create other processes, resulting in a hierarchical structure.
Process States
Running, Sleeping, Stopped, Zombie, Orphan
Running process
Actively executing on the CPU
Sleeping process
Waiting for an event
Stopped process
Paused, typically by a user command
Zombie process
A process that has finished executing, but its parent hasn't retrieved its exit status
Orphan process
A process whose parent has terminated, and it is re-parented to the init process.
Rogue process
A process that encounters an error and continuously uses up system resources.
ps command
Process status. Displays information about currently running processes.
top command
Provides a dynamic, real-time view of processes and system resource usage
htop command
An interactive and enhanced version of top
systemctl command
Manage system daemons
init daemon
First process started by Linux kernel (PPID of 0)
PID 0 refers to...
The kernel itself
ps -f command
Full option. Displays more complete info such as UID, PPID, start time, and CPU utilization
ps -e command
Entire option. Displays entire list of processes
PRI
Process priority. Measured between 0 (high) and 127 (low) priorities.
Nice value
Can be used to indirectly affect process priority. Measured between -20 (greater chance of higher priority) and +19 (greater chance of lower priority).
pstree command
Displays lineage of process by tracing its PPIDs back to init daemon
kill command
Sends a kill signal to a process to terminate it
kill -l command
Displays a list of kill signal names and associated numbers.
SIGHUP
1. Hang-up signal. It stops a process, then restarts it with the same PID.
SIGINT
2. Interrupt signal. Used when you do CTRL+C in the terminal.
SIGQUIT
3. Core dump. Terminates a process by taking the process info in memory and saving it to a file called 'core' on the disk
SIGTERM
15. Termination signal. The most common kill signal (and default for kill command)
SIGKILL
9. Absolute kill signal, forcing the kernel to stop executing the process.
killall command
Kills multiple processes of the same name in one command
pkill command
Kills processes by process name, PPID, UID, etc
Forking
Creating a new subshell
Subshell
Executes a program or script with the exec function
Foreground processes
Active in your terminal session
Background processes
Shell immediately returns the shell prompt to enter another command
jobs command
Indicates the two most recent background processes
kill -2 %1
Sends an interrupt signal to a background process
To move a background process to the foreground...
Use the fg command followed by the background job ID
Since the PRI can't be directly changed, what should you do?
Assign a certain nice value to a process.
Negative nice value
Increases the likelihood that a process will receive more time slices
Positive nice value
Decreases the likelihood that a process will receive more time slices.
renice command
Alters priority after a process has been started
at daemon
Executes once in the future
cron daemon
Executes repeatedly in the future
at -l command
Displays a list of at job IDs
at -c command
Displays contents of a specified at job
at -d command
Removes the specified at job
/etc/cron.allow file
Lists users allowed to use cron daemon
/etc/cron.deny file
Lists users not allowed to use cron daemon
What happens if both allow and deny files exist?
Only the allow file is processed.
What happens if neither the allow or deny file exists?
All users are allowed to schedule tasks.
crontab command
Creates or edits user cron tables
crontab -e command
To edit cron tables in an editor
crontab -l command
To list your user cron table
crontab -r command
Removes a cron table and all scheduled jobs
crontab -u command
Used by the root user to edit, list, or remove user cron table
Cron table format
minute (0 - 59)
hour (0 - 23)
day of month (1 - 31)
month (1 - 12 or jan - dec)
day of week (0 - 6 or sun - sat)
user
command