SlideShare a Scribd company logo
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Linux Essenciais and System Administration
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Key Knowledge Areas
Run jobs in the foreground and background.
Signal a program to continue running after logout.
Monitor active processes.
Select and sort processes for display.
Send signals to processes.
Unix Commands
Create, monitor and kill processes
Terms and Utilities
& bg
fg jobs
kill nohup
ps top
free uptime
killall
2
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Create, monitor and kill processes
Process wraps up everything needed to know about a running piece of software.
Meta information includes the machine code for the software, and things like what
user/group pair is running the process, when it was started, what command line was, etc.
Pertinent parts of a process:
PID; PPID; UID/GID; Command; Start Time; CPU Time; CWD; State; TTY; Environment; Priority; Nice; Level
Processes structure
3
PID
Process ID
•Linux uses this number to uniquely identify every process on the computer
•Number from 1-32768 ( default - can change the maximum )
•Assigns new PIDs incrementally by 1, 2 or 4
•Loops back to 1 after hitting the maximum
PPID
Parent Process ID
•PID of the process that started this one
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Create, monitor and kill processes
UID/GID
The User and Group running the process
•Very important! Defines access and permissions to file system and operating system.
•Inherited from Parent process unless: SetUID/SetGID bits on executable
•Completes the Circle of Security
Processes structure
4
command
The command (and arguments) for the process
•Identifies the executable running, as well as the arguments passed at invocation
start & cpu time
Start Time tracks when the process was started
•CPU Time tracks time the process actually spends running on the CPU
CWD
Current Working Directory
•Inherited from parent process
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Create, monitor and kill processes
state
State of the process:
•Runnable; Stopped; Blocked – Interruptible; Blocked - Non-interruptible; Zombie
Processes structure
5
TTY
•Connected terminal
•Mostly informational
•Inherited from parent process
environment
•Every process has it’s own Environment
•Inherited from parent process
priority
•Priority is a read-only value showing current priority assigned by the scheduler
•Ranges from 0-99, with higher values representing higher priorities.
•The scheduler constantly adjusts priorities to balance efficiency, performance and responsiveness
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Create, monitor and kill processes
nice
nice level represents the influence on the calculations the kernel uses when assigning priorities.
•Originally designed and named to allow users to be “nice” to other users of the system by assigning a
higher nice value to an intensive process, which in turn lowers it’s priority.
•Ranges from -20 to 19. Default nice level is 0.
•Only root can assign negative nice values.
See slides: Modify process execution priorities v2.ppt
Processes structure
6
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Create, monitor and kill processes
Job control - Ability to selectively suspend execution of processes and continue their execution later.
A job is a process or a pipeline of processes that were started by the shell.
Job control
7
job which receives keyboard input is called the foreground job.
•When a foreground process is running, it receives keyboard input and signals.
•Processes started are run in foreground by default and continue until they exit.
To run a process in background – input command followed by special character &
•Processes running in the background may still send output to the terminal.
•They do not receive keyboard input unless they are brought to the foreground.
When bash starts a background job, it prints a line with:
- job number and - process ID of last process in pipeline
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Create, monitor and kill processes
command jobs displays current list of jobs either running or stopped.
jobs
8
foo:~ $ dd if=/dev/zero of=/dev/null bs=1 &
[1] 1181
foo:~ $ cat /dev/urandom | grep hello &
[2] 1183
foo:~ $ jobs
[1]- Running dd if=/dev/zero of=/dev/null bs=1 &
[2]+ Running cat /dev/urandom | grep hello &
Ex:
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Create, monitor and kill processes
Control jobs
9
key sequences entered to foreground processes:
Key Signal Meaning Usage
Ctrl+C SIGINT Interrupt Interrupt the program running in the foreground
Ctrl+Z SIGSTOP Suspend Suspend the program running in the foreground
cmds entered to control background processes.
Command Meaning Usage
fg foreground Run the background job in the foreground. If it has suspended, restart it.
bg background Restart a suspended job.
fg makes most recently executed job a foreground job.
You can specify a specific job number. (Ex. fg 2 will make job 2 run in the foreground)
bg makes most recently executed job continue to run in background.
You can make a specific job run in the background by specifying a job number (Ex. bg 2)
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Create, monitor and kill processes
Control jobs
10
kill command
kill job based on job number (instead of PID) using percentage sign to specify the job number
foo:~ $ jobs
[1]- Running dd if=/dev/zero of=/dev/null bs=1 &
[2]+ Running cat /dev/urandom | grep hello &
foo:~ $ kill %1
foo:~ $
[1]- Terminated dd if=/dev/zero of=/dev/null bs=1
foo:~ $ jobs
[2]+ Running cat /dev/urandom | grep hello &
foo:~ $ kill %2
foo:~ $
[2]+ Terminated cat /dev/urandom | grep hello
Ex:
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Create, monitor and kill processes
Monitoring processes
11
ps – process status
options supported by ps are somewhat complex.
GNU version supports: Unix98 options (letters); BSD options (dash); GNU options (two dashes).
To ... Unix98 BSD
- Show all processes ps -ax ps -A ps -e
- Show full info ps -u (user format) ps -f (full listing)
- Show full info for all processes ps -aux ps -ef ps -Af
foo:~ $ ps -f
UID PID PPID C STIME TTY TIME CMD
georgem 987 612 0 20:32 pts/2 00:00:00 /bin/bash
georgem 3398 987 0 21:11 pts/2 00:00:00 ps -f
foo:~ $ ps u
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
georgem 987 0.0 1.7 4676 2040 pts/2 S 20:32 0:00 /bin/bash
georgem 3399 0.0 0.5 2524 696 pts/2 R 21:11 0:00 ps u
Ex:
ps -w – display in wide format
ps -f – display in forest of processes, similar to output of pstree - Generate hierarchical view of
processes.
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Create, monitor and kill processes
Processes states
12
5 basic process states:
1. Runnable Process is running, or is set to run.
•Linux is a multi-tasking it’s hard to see exactly when processes are running (switched so quickly),
•state is runnable, indicating that the scheduler will provide CPU time when it’s available.
2. Stopped Process will not get CPU time
•Nothing happens to the process - it’s still in memory, poised, ready to go.
•But when it’s put in the stopped state, scheduler will not put it on the CPU.
•Files/network connections remain open, but network connections may drop after a time (timeout).
3. Blocked/Sleeping – interrutible Process is waiting for some event
•Event can be an alarm from a sleep system call, or a signal or other external event.
•Interruptible means that other processes/events can break the sleep.
4. Blocked/Sleeping - non-interrutible Sleep state generally caused by IO operations
accessing a drive, communicating with network, etc.
•Non-interruptible means that other processes/events can not break this sleep.
•This process is unable to respond to signals.
5. Zombie/Defunct Exited process whose parent did not wait() on child
•Does not consume resources beyond a PID and meta information storage ( < 1k generally )
•Generally caused by2 situations:
- Bug in software
- Overly taxed machine
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Create, monitor and kill processes
Monitoring processes
13
top – displays processes that use up the most CPU or memory.
Ex:
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Create, monitor and kill processes
Disconnected processes
14
commands nohup and setsid
- used to run processes disconnected from terminal that started them.
nohup sets the signal mask for the process it starts to ignore the SIGHUP signal.
SIGHUP signal is sent to each process when the shell exits. - happens when you exit a session on console, or via network connection.
•nohup writes the output to a file - nohup.out
•nohup is generally used - When you know that the process you are going to run should continue to
run after your session ends.
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Create, monitor and kill processes
Signals
15
Processes in Linux do not communicate with each other directly, but send each other signals
via kernel.
most common signal sent is SIGTERM,
means Terminate, unless you know what to do
signal(7) man page.
Ex:
http://linux.about.com/od/commands/l/blcmdl7_signal.htm
First form of Interprocess Communication ( IPC )
A signal is a message sent to a process to indicate
events or other conditions.
The signal itself is the message – there around
three dozen defined signals...
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
Fim de sessão
16

More Related Content

PPT
3.5 create, monitor and kill processes v2
PPT
101 3.4 use streams, pipes and redirects v2
PDF
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
PDF
Kernel Recipes 2017: Performance Analysis with BPF
PDF
Kernel Recipes 2019 - CVEs are dead, long live the CVE!
PPT
3.4 use streams, pipes and redirects v2
PDF
Performance Analysis Tools for Linux Kernel
ODP
Linux kernel debugging(ODP format)
3.5 create, monitor and kill processes v2
101 3.4 use streams, pipes and redirects v2
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
Kernel Recipes 2017: Performance Analysis with BPF
Kernel Recipes 2019 - CVEs are dead, long live the CVE!
3.4 use streams, pipes and redirects v2
Performance Analysis Tools for Linux Kernel
Linux kernel debugging(ODP format)

What's hot (20)

PDF
The origin: Init (compact version)
PDF
Kernel Recipes 2017: Using Linux perf at Netflix
PPT
101 1.3 runlevels , shutdown, and reboot
PPT
101 1.3 runlevels, shutdown, and reboot v2
PDF
Kernel Recipes 2019 - BPF at Facebook
PPT
1.3 runlevels, shutdown, and reboot v3
PDF
Systems@Scale 2021 BPF Performance Getting Started
PDF
UM2019 Extended BPF: A New Type of Software
ODP
Linux kernel tracing superpowers in the cloud
PDF
Kernel Recipes 2019 - Kernel documentation: past, present, and future
PDF
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling Tools
PDF
BPF Internals (eBPF)
PDF
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
PDF
Kernel Recipes 2019 - Formal modeling made easy
PDF
Container Performance Analysis
PDF
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
PDF
eBPF Trace from Kernel to Userspace
PDF
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
PDF
BPF: Tracing and more
PDF
Linux Performance Profiling and Monitoring
The origin: Init (compact version)
Kernel Recipes 2017: Using Linux perf at Netflix
101 1.3 runlevels , shutdown, and reboot
101 1.3 runlevels, shutdown, and reboot v2
Kernel Recipes 2019 - BPF at Facebook
1.3 runlevels, shutdown, and reboot v3
Systems@Scale 2021 BPF Performance Getting Started
UM2019 Extended BPF: A New Type of Software
Linux kernel tracing superpowers in the cloud
Kernel Recipes 2019 - Kernel documentation: past, present, and future
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling Tools
BPF Internals (eBPF)
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel Recipes 2019 - Formal modeling made easy
Container Performance Analysis
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
eBPF Trace from Kernel to Userspace
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
BPF: Tracing and more
Linux Performance Profiling and Monitoring
Ad

Similar to 101 3.5 create, monitor and kill processes v2 (20)

PPT
101 3.5 create, monitor and kill processes
PPTX
System Administration: Linux Process
PPTX
578781849-RHSA-1-Chap578781850-RHSA-1-Chapter-4ter-7.pptx
PPTX
13 process management
DOCX
LP-Unit3.docx
PPTX
Managing Processes in Unix.pptx
PPTX
Managing Processes in Unix.pptx
PPTX
unix- the process states, zombies, running jobs in background
PPTX
UNIX Notes
PDF
Process management
PPTX
AOS_Module_4ssssssssssssssssssssssss.pptx
PPTX
Linux system administration
PPTX
Resource Monitoring and management
PDF
Unit 10 investigating and managing
DOCX
InstructionsInstructions for numberguessernumberGuesser.html.docx
PDF
Course 102: Lecture 17: Process Monitoring
PDF
Linux Internals - Part II
DOCX
Week 11Linux InternalsProcesses, schedulingLecture o.docx
PDF
Linux fundamental - Chap 08 proc
PPT
Processes And Job Control
101 3.5 create, monitor and kill processes
System Administration: Linux Process
578781849-RHSA-1-Chap578781850-RHSA-1-Chapter-4ter-7.pptx
13 process management
LP-Unit3.docx
Managing Processes in Unix.pptx
Managing Processes in Unix.pptx
unix- the process states, zombies, running jobs in background
UNIX Notes
Process management
AOS_Module_4ssssssssssssssssssssssss.pptx
Linux system administration
Resource Monitoring and management
Unit 10 investigating and managing
InstructionsInstructions for numberguessernumberGuesser.html.docx
Course 102: Lecture 17: Process Monitoring
Linux Internals - Part II
Week 11Linux InternalsProcesses, schedulingLecture o.docx
Linux fundamental - Chap 08 proc
Processes And Job Control
Ad

More from Acácio Oliveira (20)

PPTX
Security+ Lesson 01 Topic 24 - Vulnerability Scanning vs Pen Testing.pptx
PPTX
Security+ Lesson 01 Topic 25 - Application Security Controls and Techniques.pptx
PPTX
Security+ Lesson 01 Topic 21 - Types of Application Attacks.pptx
PPTX
Security+ Lesson 01 Topic 19 - Summary of Social Engineering Attacks.pptx
PPTX
Security+ Lesson 01 Topic 23 - Overview of Security Assessment Tools.pptx
PPTX
Security+ Lesson 01 Topic 20 - Summary of Wireless Attacks.pptx
PPTX
Security+ Lesson 01 Topic 22 - Security Enhancement Techniques.pptx
PPTX
Security+ Lesson 01 Topic 15 - Risk Management Best Practices.pptx
PPTX
Security+ Lesson 01 Topic 13 - Physical Security and Environmental Controls.pptx
PPTX
Security+ Lesson 01 Topic 14 - Disaster Recovery Concepts.pptx
PPTX
Security+ Lesson 01 Topic 06 - Wireless Security Considerations.pptx
PPTX
Security+ Lesson 01 Topic 04 - Secure Network Design Elements and Components....
PPTX
Security+ Lesson 01 Topic 02 - Secure Network Administration Concepts.pptx
PPTX
Security+ Lesson 01 Topic 01 - Intro to Network Devices.pptx
PPTX
Security+ Lesson 01 Topic 08 - Integrating Data and Systems with Third Partie...
PPTX
Security+ Lesson 01 Topic 07 - Risk Related Concepts.pptx
PPTX
Security+ Lesson 01 Topic 05 - Common Network Protocols.pptx
PPTX
Security+ Lesson 01 Topic 11 - Incident Response Concepts.pptx
PPTX
Security+ Lesson 01 Topic 12 - Security Related Awareness and Training.pptx
PPTX
Security+ Lesson 01 Topic 17 - Types of Malware.pptx
Security+ Lesson 01 Topic 24 - Vulnerability Scanning vs Pen Testing.pptx
Security+ Lesson 01 Topic 25 - Application Security Controls and Techniques.pptx
Security+ Lesson 01 Topic 21 - Types of Application Attacks.pptx
Security+ Lesson 01 Topic 19 - Summary of Social Engineering Attacks.pptx
Security+ Lesson 01 Topic 23 - Overview of Security Assessment Tools.pptx
Security+ Lesson 01 Topic 20 - Summary of Wireless Attacks.pptx
Security+ Lesson 01 Topic 22 - Security Enhancement Techniques.pptx
Security+ Lesson 01 Topic 15 - Risk Management Best Practices.pptx
Security+ Lesson 01 Topic 13 - Physical Security and Environmental Controls.pptx
Security+ Lesson 01 Topic 14 - Disaster Recovery Concepts.pptx
Security+ Lesson 01 Topic 06 - Wireless Security Considerations.pptx
Security+ Lesson 01 Topic 04 - Secure Network Design Elements and Components....
Security+ Lesson 01 Topic 02 - Secure Network Administration Concepts.pptx
Security+ Lesson 01 Topic 01 - Intro to Network Devices.pptx
Security+ Lesson 01 Topic 08 - Integrating Data and Systems with Third Partie...
Security+ Lesson 01 Topic 07 - Risk Related Concepts.pptx
Security+ Lesson 01 Topic 05 - Common Network Protocols.pptx
Security+ Lesson 01 Topic 11 - Incident Response Concepts.pptx
Security+ Lesson 01 Topic 12 - Security Related Awareness and Training.pptx
Security+ Lesson 01 Topic 17 - Types of Malware.pptx

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Encapsulation theory and applications.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Getting Started with Data Integration: FME Form 101
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPT
Teaching material agriculture food technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Mushroom cultivation and it's methods.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
A Presentation on Artificial Intelligence
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Encapsulation theory and applications.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Unlocking AI with Model Context Protocol (MCP)
Heart disease approach using modified random forest and particle swarm optimi...
MIND Revenue Release Quarter 2 2025 Press Release
cloud_computing_Infrastucture_as_cloud_p
Getting Started with Data Integration: FME Form 101
Digital-Transformation-Roadmap-for-Companies.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Teaching material agriculture food technology
Per capita expenditure prediction using model stacking based on satellite ima...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Encapsulation_ Review paper, used for researhc scholars
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Mushroom cultivation and it's methods.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
A Presentation on Artificial Intelligence
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Group 1 Presentation -Planning and Decision Making .pptx

101 3.5 create, monitor and kill processes v2