Difference between revisions of "CLI Process Management"

From FreekiWiki
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
  xeyes = A silly program that displays a graphic depicting a set of eyes that follow your mouse pointer.
 
  xeyes = A silly program that displays a graphic depicting a set of eyes that follow your mouse pointer.
  
  fg = put a process into the foreground
+
  fg = Put a process into the foreground
  bg = put a process into the background
+
  bg = Put a process into the background
  
  Ctrl+z = suspend a process
+
  Ctrl+z = Suspend a process
  
  ps = List the processes running on your system
+
  ps   = List the processes running on your system
 +
jobs = List the jobs executing in this terminal's context
  
  kill = send a signal to a process
+
  kill = Send a signal to a process
 +
 
 +
&    = Indicates that a process is running in the background
  
 
== Examples ==
 
== Examples ==
 +
 +
# Execute 'xeyes -color red'
 +
# Click on the terminal to give it the focus
 +
# Press <Ctrl-z> (this will suspend the application, notice the eyes are no longer following the mouse)
 +
# Execute 'xeyes -color red'
 +
# Click on the terminal to give it the focus
 +
# Press '<Ctrl>+z'
 +
# Execute 'jobs'
 +
# Execute 'bg %1' (Notice that the red eyes are now following your cursor and that the terminal is available to you)
 +
 +
 +
  
 
== Quiz ==
 
== Quiz ==
 +
# Launch the 'emacs' program in the background.
 +
# Put it into the foreground.
 +
# Suspend it.
 +
# Restart it in the background.
 +
# Kill it.
 +
 +
== Instructor Notes ==
 +
This page needs more quiz items? There is only one quiz question broken down into multiple parts.
 +
 +
[[Category:CLI Quizes]]
 +
[[Category:Classes]]

Latest revision as of 11:55, 19 April 2008

Introduction

Every time you run a command on the command line, it has to run for some period of time. Linux knows how to get the resources that the program needs to run for its lifetime. The command and its resources are called a 'process'. So, a process is just something that is running on your system. Processes aren't limited to programs that you've started on the command line, everything running on your system is a process, including BASH. Linux manages these processes and you have the ability to interact with them using the command line.

Commands

xeyes = A silly program that displays a graphic depicting a set of eyes that follow your mouse pointer.
fg = Put a process into the foreground
bg = Put a process into the background
Ctrl+z = Suspend a process
ps   = List the processes running on your system
jobs = List the jobs executing in this terminal's context
kill = Send a signal to a process
&    = Indicates that a process is running in the background

Examples

  1. Execute 'xeyes -color red'
  2. Click on the terminal to give it the focus
  3. Press <Ctrl-z> (this will suspend the application, notice the eyes are no longer following the mouse)
  4. Execute 'xeyes -color red'
  5. Click on the terminal to give it the focus
  6. Press '<Ctrl>+z'
  7. Execute 'jobs'
  8. Execute 'bg %1' (Notice that the red eyes are now following your cursor and that the terminal is available to you)


Quiz

  1. Launch the 'emacs' program in the background.
  2. Put it into the foreground.
  3. Suspend it.
  4. Restart it in the background.
  5. Kill it.

Instructor Notes

This page needs more quiz items? There is only one quiz question broken down into multiple parts.