Your SlideShare is downloading. ×
0
Junior Level Linux Certification
Exam Objectives
Key Knowledge Areas
Run jobs in the foreground and background.
Signal a program to continue running after ...
Create, monitor and kill processes
Job control - Ability to selectively suspend execution of processes and continue their ...
Create, monitor and kill processes
Job control - Ability to selectively suspend execution of processes and continue their ...
Create, monitor and kill processes
command jobs displays current list of jobs either running or stopped.
jobs
5
foo:~ $ dd...
Create, monitor and kill processes
Control jobs
6
key sequences entered to foreground processes:
Key Signal Meaning Usage
...
Create, monitor and kill processes
Control jobs
7
kill command
kill job based on job number (instead of PID) using percent...
Create, monitor and kill processes
Disconnected processes
8
commands nohup and setsid
- used to run processes disconnected...
Create, monitor and kill processes
Monitoring processes
9
ps – process status
options supported by ps are somewhat complex...
Create, monitor and kill processes
Monitoring processes
10
top – displays processes that use up the most CPU or memory.
Ex:
Create, monitor and kill processes
Signals
11
Processes in Linux do not communicate with each other directly, but send eac...
Fim de sessão
12
Upcoming SlideShare
Loading in...5
×

101 3.5 create, monitor and kill processes

218

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
218
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
10
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "101 3.5 create, monitor and kill processes"

  1. 1. Junior Level Linux Certification
  2. 2. Exam Objectives 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. Objective 3: GNU and Unix Commands Create, monitor and kill processes Weight: 4 Terms and Utilities & bg fg jobs kill nohup ps top free uptime killall 2
  3. 3. 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 3 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
  4. 4. 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 4 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
  5. 5. Create, monitor and kill processes command jobs displays current list of jobs either running or stopped. jobs 5 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:
  6. 6. Create, monitor and kill processes Control jobs 6 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)
  7. 7. Create, monitor and kill processes Control jobs 7 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:
  8. 8. Create, monitor and kill processes Disconnected processes 8 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.
  9. 9. Create, monitor and kill processes Monitoring processes 9 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 -uax 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.
  10. 10. Create, monitor and kill processes Monitoring processes 10 top – displays processes that use up the most CPU or memory. Ex:
  11. 11. Create, monitor and kill processes Signals 11 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
  12. 12. Fim de sessão 12
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×