SlideShare a Scribd company logo
CoreLinuxforRedHatandFedoralearningunderGNUFreeDocumentationLicense-Copyleft(c)AcácioOliveira2012
Everyoneispermittedtocopyanddistributeverbatimcopiesofthislicensedocument,changingisallowed
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
101 3.5 create, monitor and kill processes v2
PDF
Kernel Recipes 2019 - CVEs are dead, long live the CVE!
ODP
Linux kernel debugging(ODP format)
PPT
101 3.4 use streams, pipes and redirects v2
PDF
Kernel Recipes 2017: Performance Analysis with BPF
PPT
101 1.3 runlevels, shutdown, and reboot v2
PPT
101 1.3 runlevels , shutdown, and reboot
PPT
1.3 runlevels, shutdown, and reboot v3
101 3.5 create, monitor and kill processes v2
Kernel Recipes 2019 - CVEs are dead, long live the CVE!
Linux kernel debugging(ODP format)
101 3.4 use streams, pipes and redirects v2
Kernel Recipes 2017: Performance Analysis with BPF
101 1.3 runlevels, shutdown, and reboot v2
101 1.3 runlevels , shutdown, and reboot
1.3 runlevels, shutdown, and reboot v3

What's hot (20)

PDF
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
PDF
Kernel Recipes 2017: Using Linux perf at Netflix
PPT
3.4 use streams, pipes and redirects v2
PDF
Performance Analysis Tools for Linux Kernel
PDF
Kernel Recipes 2019 - Formal modeling made easy
PDF
Systems@Scale 2021 BPF Performance Getting Started
PDF
Linux Performance Profiling and Monitoring
PDF
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
PDF
Kernel crashdump
PDF
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
PPT
Galvin-operating System(Ch6)
PDF
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling Tools
PDF
Linux Tracing Superpowers by Eugene Pirogov
PDF
Kernel Recipes 2019 - Kernel documentation: past, present, and future
PDF
BPF: Tracing and more
PPT
Linux Crash Dump Capture and Analysis
PDF
IRQs: the Hard, the Soft, the Threaded and the Preemptible
PDF
BPF Internals (eBPF)
PDF
Introduction to Perf
PDF
Linux Performance Analysis: New Tools and Old Secrets
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
Kernel Recipes 2017: Using Linux perf at Netflix
3.4 use streams, pipes and redirects v2
Performance Analysis Tools for Linux Kernel
Kernel Recipes 2019 - Formal modeling made easy
Systems@Scale 2021 BPF Performance Getting Started
Linux Performance Profiling and Monitoring
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel crashdump
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Galvin-operating System(Ch6)
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling Tools
Linux Tracing Superpowers by Eugene Pirogov
Kernel Recipes 2019 - Kernel documentation: past, present, and future
BPF: Tracing and more
Linux Crash Dump Capture and Analysis
IRQs: the Hard, the Soft, the Threaded and the Preemptible
BPF Internals (eBPF)
Introduction to Perf
Linux Performance Analysis: New Tools and Old Secrets
Ad

Viewers also liked (20)

PPT
4.5 manage file permissions and ownership v3
PPT
4.8 apend backups
PDF
3.8.a how to - vim course book
PPT
3.8 perform basic file editing operations using vi
PPT
4.9.a apend tuning and performance
PPT
1.1 hardware settings v2
PPT
4.3 control mounting and unmounting of filesystems v2
PPT
4.9 apend troubleshooting tools v2
PPT
4.1 create partitions and filesystems
PPT
Apend. networking linux
PDF
1.1.b hdd block sector
PPT
Apend. kernel
PPT
4.6 create and change hard and symbolic links v2
PDF
Angebote fuer psychisch kranke, abhängigkeitskranke und geistig behinderte me...
PPT
Apend. networking generic b details
PPT
4.7 find system files and place files in the correct location
PPT
Apend. networking generic a
PPT
1.2 boot the system v2
PPT
4.4 manage disk quotas
PDF
1.1.a mbr limits v2
4.5 manage file permissions and ownership v3
4.8 apend backups
3.8.a how to - vim course book
3.8 perform basic file editing operations using vi
4.9.a apend tuning and performance
1.1 hardware settings v2
4.3 control mounting and unmounting of filesystems v2
4.9 apend troubleshooting tools v2
4.1 create partitions and filesystems
Apend. networking linux
1.1.b hdd block sector
Apend. kernel
4.6 create and change hard and symbolic links v2
Angebote fuer psychisch kranke, abhängigkeitskranke und geistig behinderte me...
Apend. networking generic b details
4.7 find system files and place files in the correct location
Apend. networking generic a
1.2 boot the system v2
4.4 manage disk quotas
1.1.a mbr limits v2
Ad

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

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

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
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Electronic commerce courselecture one. Pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Big Data Technologies - Introduction.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Encapsulation theory and applications.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
The Rise and Fall of 3GPP – Time for a Sabbatical?
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Electronic commerce courselecture one. Pdf
sap open course for s4hana steps from ECC to s4
Empathic Computing: Creating Shared Understanding
Digital-Transformation-Roadmap-for-Companies.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
The AUB Centre for AI in Media Proposal.docx
MYSQL Presentation for SQL database connectivity
Advanced methodologies resolving dimensionality complications for autism neur...
“AI and Expert System Decision Support & Business Intelligence Systems”
Dropbox Q2 2025 Financial Results & Investor Presentation
Big Data Technologies - Introduction.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
A Presentation on Artificial Intelligence
Encapsulation theory and applications.pdf

3.5 create, monitor and kill processes v2