0% found this document useful (0 votes)
63 views

10.1 MasteringLinuxCommandLine-12-Process

The document discusses Linux processes and related commands. It defines what a process is, describes how processes are created and have parent-child relationships. It covers foreground and background processes, daemons, and process IDs. It also summarizes commands for viewing and managing processes like ps, kill, and jobs. Signals and how they are used to communicate between processes are also introduced.

Uploaded by

amit_post2000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

10.1 MasteringLinuxCommandLine-12-Process

The document discusses Linux processes and related commands. It defines what a process is, describes how processes are created and have parent-child relationships. It covers foreground and background processes, daemons, and process IDs. It also summarizes commands for viewing and managing processes like ps, kill, and jobs. Signals and how they are used to communicate between processes are also introduced.

Uploaded by

amit_post2000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Mastering Linux Command Line 11/19/2019

Mastering Linux Command-line

The Process
GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

The Process
 What is a PROCESS?  “time” command
 Parent & Child Processes  Signals
 Program Vs Process  “stty” command
 Types of Processes  “kill” command
 Foreground Processes
 Background Processes  $ and $$ System Variables
 Daemons
 “wait” command
 Internal and External Commands  Job Control (jobs, fg and bg)
 “ps” command
 How is a process created?
 “nohup” command

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

Process

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

www.GlobaleTraining.com 1
Mastering Linux Command Line 11/19/2019

Process
 A program in execution is called a process.

 Linux is a multi-user and multi-tasking system.


 Multiple processes

 Each process is allocated a unique number  process identifier (PID)

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

Parent & Child Processes


 Process A creates another process B

A Parent Process
B Child Process

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

PID 0 and PID 1


 PID 0
init is the first process started by
 Swapper or sched
 Starts init or systemd
the swapper (or scheduler)

 PID 1 “systemd” is the replacement for


 init or systemd
the init process

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

www.GlobaleTraining.com 2
Mastering Linux Command Line 11/19/2019

Types of Processes

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

Types of Processes
 Interactive Process (or Foreground Process)
 Non-Interactive Process (or Background Process)
 Daemons

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

Run a command in the background


 Use & (ampersand) after the command.
 Example: $ find / -name global* > found.txt &

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

www.GlobaleTraining.com 3
Mastering Linux Command Line 11/19/2019

Process related commands


Command Purpose
ps View the list of processes
kill To kill a process
nohup To make a process run, after logging out
nice Set the priority of a process
time Get time stats of a command/process.

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

10

$! and $$
Variable Purpose
$! PID of the last background process
$$ PID of the current shell

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

11

Signals

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

12

www.GlobaleTraining.com 4
Mastering Linux Command Line 11/19/2019

Signals
 A signal is a message sent to a process.

 A parent process and child process could send signals to each other.

 Signals have:
 Name
 Number

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

13

Signals
SIGNAL Name Meaning
1 SIGUP Hang up
2 SIGINT Interrupt
3 SIGQUIT Quit
9 SIGKILL Sure Kill
15 SIGTERM Software Termination
24 SIGSTOP Stopped

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

14

Job Control Commands

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

15

www.GlobaleTraining.com 5
Mastering Linux Command Line 11/19/2019

Job Control Commands


Command Purpose
jobs Display the list of current jobs
fg Brings the background job to foreground
bg &  Put ampersand at the end of the command to run it in the
background
Ctrl-z  Suspend the foreground process, and then use “bg”
command to run the process in the background.

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

16

__ DONE __

GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com

17

www.GlobaleTraining.com 6

You might also like