Job Control Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See

Slides:



Advertisements
Similar presentations
June 1, 1999Foreground/Background Processing1 Introduction to UNIX H. Foreground/Background Processing.
Advertisements

Using tcpdump. tcpdump is a powerful tool that allows us to sniff network packets and make some statistical analysis out of those dumps. tcpdump operates.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process The Process A process is.
Processes and Job Control. Foreground and Background (1)  Unix is a multi-tasking operating system –some of these tasks are being done by other users.
CSCI 330 T HE UNIX S YSTEM Shell Job Control. T ODAY ’ S CLASS Unix is multi-user, multi-process OS Shell features to control jobs Unix utilities to manage.
Essential System Administration 3rd Edition Chapter 2 The Unix Way(Cont.) University Of Palestine.
Chapter 13 Processes. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. Objectives To describe the concept of a process, and execution of.
Introduction to Unix – CS 21 Lecture 10. Lecture Overview Midterm questions Jobs and processes description The foreground and background Controlling jobs.
Process Relationships Terminal and Network Logins Process Groups and Sessions Job Control Relationships.
Lesson 10-Controlling User Processes. Overview Managing and processing processes. Managing jobs. Exiting/quitting when jobs have been stopped.
A Practical Guide to Red Hat ® Linux ®, Third Edition. © 2007 Mark G. Sobell, Prentice Hall,
System Programming Project 2 Due : 4/19...?. Foreground & Background Foreground job Foreground job Only one at moment Only one at moment Having user’s.
Chapter 13 Processes. What is a process? A process is a program in execution A process is created whenever an external command is executed Whenever the.
Shells and Processes Bryce Boe 2012/08/08 CS32, Summer 2012 B.
Linux+ Guide to Linux Certification, Second Edition
More Shell Basics CS465 - Unix. Unix shells User’s default shell - specified in /etc/passwd file To show which shell you are currently using: $ echo $SHELL.
Processes & Daemons Chapter IV / Part III. Commands Internal commands: alias, cd, echo, pwd, time External commands, code is in a file: grep, ls, more.
Introduction Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
5 UNIX Processes. Introduction  Processes  How to list them  How to terminate them  Process priorities  Scheduling jobs  Signals.
UNIX Processes. The UNIX Process A process is an instance of a program in execution. Created by another parent process as its child. One process can be.
Operating Systems Yasir Kiani. 22-Sep Agenda for Today Review of previous lecture Process management commands: bg, fg, ^Z, jobs, ^C, kill Thread.
UNIX command line. In this module you will learn: What is the computer shell What is the command line interface What is the directory tree Some UNIX commands.
Managing Processes CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.
Chapter 4 UNIX Common Shells Commands By C. Shing ITEC Dept Radford University.
Linux+ Guide to Linux Certification, Third Edition
Processes and Threads CS550 Operating Systems. Processes and Threads These exist only at execution time They have fast state changes -> in memory and.
Additional UNIX Commands. 222 Lecture Overview  Multiple commands and job control  More useful UNIX utilities.
1 Day 10 Process Control. 2 Running a program in the background Here’s a trick: You can actually log onto a UNIX server as many times as you want Try.
Process Control. Module 11 Process Control ♦ Introduction ► A process is a running occurrence of a program, including all variables and other conditions.
SUSE Linux Enterprise Server Administration (Course 3037) Chapter 6 Manage Linux Processes and Services.
Managing processes and services. 1. How Linux handles processes 2. Managing running processes 3. Scheduling processes.
Linux+ Guide to Linux Certification, Second Edition Chapter 10 Managing Linux Processes.
The kernel considers each program running on your system to be a process A process lives as it executes, with a lifetime that may be short or long A process.
Pipes and Filters Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Hands On UNIX II Dorcas Muthoni. Processes A running instance of a program is called a "process" Identified by a numeric process id (pid)‏  unique while.
Files and Directories Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
ICS 431 – Operating System. a command-line interpreter. a program that interprets commands and acts as an intermediary between the user and the inner.
Scis.regis.edu ● CS 468: Advanced UNIX Class 5 Dr. Jesús Borrego Regis University 1.
Linux+ Guide to Linux Certification Chapter Eleven Managing Linux Processes.
1 Lecture 6 Introduction to Process Management COP 3353 Introduction to UNIX.
CIT 140: Introduction to ITSlide #1 CSC 140: Introduction to IT Processes.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Linux Commands C151 Multi-User Operating Systems.
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 9 Working.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop VI Scheduling & Process Management Professional.
CSC414 “Introduction to UNIX/ Linux” Lecture 3
©Brooks/Cole, 2001 Figure 5-14 Job States fg. ©Brooks/Cole, 2001 백그라운드 / 포그라운드 (Background/Foreground Jobs) - 오랜 시간 작업을 요하며 터미널에서 입력을 받지 않는 작업인 경우 백그라운드.
Agenda Managing Processes (Jobs) Command Grouping Running jobs in background (bg) Bringing jobs to foreground (fg), Background job status (jobs) Suspending.
PROCESSES We will learn more about: ¨ Multi-user processing and multi −tasking ¨ Multi-user processing and multi −tasking ¨ Process types ¨ Process types.
Unix System Administration Controlling Processes Chapter 5.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
An Introduction to processes R Bigelow. A Unix Process A process in Unix is simple a program The Unix system is made up of a group of processes all interacting.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Process Relationships Chien-Chung Shen CIS/UD
Foreground and background processes
IT244 - Introduction to Linux / Unix Instructor: Bo Sheng
Chapter 13 Processes.
...looking a bit closer under the hood
Rootly Powers and Controlling Processes
Chapter 11 – Processes and Services
C151 Multi-User Operating Systems
Hands On UNIX AfNOG 2010 Kigali, Rwanda
CSE 374 Programming Concepts & Tools
Hands On UNIX AfNOG X Cairo, Egypt
The Linux Command Line Chapter 10
Operating Systems Lecture 12.
CHAPTER 13 Processes.
CSC 140: Introduction to IT
Lab 6: Process Management
Lecture 6 Introduction to Process Management
Presentation transcript:

Job Control Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See for more information. The Unix Shell

Job ControlIntroduction shell

Job ControlIntroduction shell $ wc –l *.pdb | sort | head -1

Job ControlIntroduction shell wc $ wc –l *.pdb | sort | head -1 sorthead

Job ControlIntroduction shell wc $ wc –l *.pdb | sort | head -1 sorthead Control programs while they run

Job ControlIntroduction shell wc $ wc –l *.pdb | sort | head -1 sorthead Control programs while they run processes

Job ControlIntroduction A process is a running program

Job ControlIntroduction A process is a running program Some are yours

Job ControlIntroduction A process is a running program Some are yours Most belong to the operating system (or other users)

Job ControlIntroduction A process is a running program Some are yours Most belong to the operating system (or other users) Use ps to get a list

Job ControlIntroduction A process is a running program Some are yours Most belong to the operating system (or other users) Use ps to get a list $ ps PID PPID PGID TTY UID STIME COMMAND con :19:07 /usr/bin/bash con :53:48 /usr/bin/ps $

Job ControlIntroduction A process is a running program Some are yours Most belong to the operating system (or other users) Use ps to get a list $ ps PID PPID PGID TTY UID STIME COMMAND con :19:07 /usr/bin/bash con :53:48 /usr/bin/ps $ Process ID (unique at any moment)

Job ControlIntroduction A process is a running program Some are yours Most belong to the operating system (or other users) Use ps to get a list $ ps PID PPID PGID TTY UID STIME COMMAND con :19:07 /usr/bin/bash con :53:48 /usr/bin/ps $ Parent process ID

Job ControlIntroduction A process is a running program Some are yours Most belong to the operating system (or other users) Use ps to get a list $ ps PID PPID PGID TTY UID STIME COMMAND con :19:07 /usr/bin/bash con :53:48 /usr/bin/ps $ Parent process ID What process created this one?

Job ControlIntroduction A process is a running program Some are yours Most belong to the operating system (or other users) Use ps to get a list $ ps PID PPID PGID TTY UID STIME COMMAND con :19:07 /usr/bin/bash con :53:48 /usr/bin/ps $ Process group ID

Job ControlIntroduction A process is a running program Some are yours Most belong to the operating system (or other users) Use ps to get a list $ ps PID PPID PGID TTY UID STIME COMMAND con :19:07 /usr/bin/bash con :53:48 /usr/bin/ps $ What terminal (TTY) is it running in?

Job ControlIntroduction A process is a running program Some are yours Most belong to the operating system (or other users) Use ps to get a list $ ps PID PPID PGID TTY UID STIME COMMAND con :19:07 /usr/bin/bash con :53:48 /usr/bin/ps $ What terminal (TTY) is it running in? '?' indicates a system service (no TTY)

Job ControlIntroduction A process is a running program Some are yours Most belong to the operating system (or other users) Use ps to get a list $ ps PID PPID PGID TTY UID STIME COMMAND con :19:07 /usr/bin/bash con :53:48 /usr/bin/ps $ The user ID of the process's owner

Job ControlIntroduction A process is a running program Some are yours Most belong to the operating system (or other users) Use ps to get a list $ ps PID PPID PGID TTY UID STIME COMMAND con :19:07 /usr/bin/bash con :53:48 /usr/bin/ps $ The user ID of the process's owner Controls what the process can read, write, execute, …

Job ControlIntroduction A process is a running program Some are yours Most belong to the operating system (or other users) Use ps to get a list $ ps PID PPID PGID TTY UID STIME COMMAND con :19:07 /usr/bin/bash con :53:48 /usr/bin/ps $ When the process was started

Job ControlIntroduction A process is a running program Some are yours Most belong to the operating system (or other users) Use ps to get a list $ ps PID PPID PGID TTY UID STIME COMMAND con :19:07 /usr/bin/bash con :53:48 /usr/bin/ps $ The program the process is executing

Job ControlIntroduction Can stop, pause, and resume running processes

Job ControlIntroduction Can stop, pause, and resume running processes $./analyze results*.dat

Job ControlIntroduction $./analyze results*.dat...a few minutes pass... Can stop, pause, and resume running processes

Job ControlIntroduction $./analyze results*.dat...a few minutes pass... ^C $ Can stop, pause, and resume running processes

Job ControlIntroduction $./analyze results*.dat...a few minutes pass... ^C $ Stop the running program Can stop, pause, and resume running processes

Job ControlIntroduction $./analyze results*.dat...a few minutes pass... ^C $./analyze results*.dat & $ Can stop, pause, and resume running processes

Job ControlIntroduction $./analyze results*.dat...a few minutes pass... ^C $./analyze results*.dat & $ Run in the background Can stop, pause, and resume running processes

Job ControlIntroduction $./analyze results*.dat...a few minutes pass... ^C $./analyze results*.dat & $ Run in the background Shell returns right away instead of waiting for the program to finish Can stop, pause, and resume running processes

Job ControlIntroduction $./analyze results*.dat...a few minutes pass... ^C $./analyze results*.dat & $ fbcmd events $ Can run other programs in the foreground while waiting for background process(es) to finish Can stop, pause, and resume running processes

Job ControlIntroduction $./analyze results*.dat...a few minutes pass... ^C $./analyze results*.dat & $ fbcmd events $ jobs [1]./analyze results01.dat results02.dat results03.dat $ Can stop, pause, and resume running processes

Job ControlIntroduction $./analyze results*.dat...a few minutes pass... ^C $./analyze results*.dat & $ fbcmd events $ jobs [1]./analyze results01.dat results02.dat results03.dat $ Can stop, pause, and resume running processes Show background processes

Job ControlIntroduction $./analyze results*.dat...a few minutes pass... ^C $./analyze results*.dat & $ fbcmd events $ jobs [1]./analyze results01.dat results02.dat results03.dat $ fg Can stop, pause, and resume running processes

Job ControlIntroduction $./analyze results*.dat...a few minutes pass... ^C $./analyze results*.dat & $ fbcmd events $ jobs [1]./analyze results01.dat results02.dat results03.dat $ fg Bring background job to foreground Can stop, pause, and resume running processes

Job ControlIntroduction $./analyze results*.dat...a few minutes pass... ^C $./analyze results*.dat & $ fbcmd events $ jobs [1]./analyze results01.dat results02.dat results03.dat $ fg Bring background job to foreground Use fg %1, fg %2, etc. if there are several background jobs Can stop, pause, and resume running processes

Job ControlIntroduction $./analyze results*.dat...a few minutes pass... ^C $./analyze results*.dat & $ fbcmd events $ jobs [1]./analyze results01.dat results02.dat results03.dat $ fg...a few minutes pass... $ And finally it's done Can stop, pause, and resume running processes

Job ControlIntroduction Use ^Z to pause a program that's already running

Job ControlIntroduction Use ^Z to pause a program that's already running fg to resume it in the foreground

Job ControlIntroduction Use ^Z to pause a program that's already running fg to resume it in the foreground Or bg to resume it as a background job

Job ControlIntroduction $./analyze results01.dat Use ^Z to pause a program that's already running fg to resume it in the foreground Or bg to resume it as a background job

Job ControlIntroduction $./analyze results01.dat ^Z [1] Stopped./analyze results01.dat $ Use ^Z to pause a program that's already running fg to resume it in the foreground Or bg to resume it as a background job

Job ControlIntroduction $./analyze results01.dat ^Z [1] Stopped./analyze results01.dat $ bg %1 $ Use ^Z to pause a program that's already running fg to resume it in the foreground Or bg to resume it as a background job

Job ControlIntroduction $./analyze results01.dat ^Z [1] Stopped./analyze results01.dat $ bg %1 $ jobs [1]./analyze results01.dat $ Use ^Z to pause a program that's already running fg to resume it in the foreground Or bg to resume it as a background job

Job ControlIntroduction $./analyze results01.dat ^Z [1] Stopped./analyze results01.dat $ bg %1 $ jobs [1]./analyze results01.dat $ kill %1 $ Use ^Z to pause a program that's already running fg to resume it in the foreground Or bg to resume it as a background job

Job ControlIntroduction Job control mattered a lot when users only had one terminal window

Job ControlIntroduction Job control mattered a lot when users only had one terminal window Less important now: just open another window

Job ControlIntroduction Job control mattered a lot when users only had one terminal window Less important now: just open another window Still useful when running programs remotely

August 2010 created by Greg Wilson Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See for more information.