Checking job status with jobs

Occasionally, you may have multiple jobs running or suspended and need a quick update about the jobs' status. Using jobs, you can find out whether a job is running, stopped, or waiting for input (with tty, for example), as shown in Code Listing 9.5.

To check job status with jobs:

  • jobs

    At the shell prompt, type jobs. You'll see a list of the current jobs (that is, processes that you've suspended or otherwise controlled) either running or stopped, as shown in Code Listing 9.5. Using the job numbers on the left, you can choose to run the jobs in the background or foreground, to resume them, or to kill the jobs, as described in the next few sections in this chapter.

Tip

Depending on your shell, you can often kill jobs with kill followed by a % and the job number or command nameā€”for example, you could kill the ftp job in Code Listing 9.5 with kill %ftp or kill %1. See Deleting processes with kill later in this chapter for more on killing jobs.


Code Listing 9.5. Viewing jobs lets you know which jobs you have suspended and what their status is.
[ejr@hobbes ejr]$ jobs
[1]-  Running               ftp calvin.raycomm.com &
[2]+  Stopped (tty input)   telnet
[3]   Stopped (signal)      lynx http://www.raycomm.com/
 [ejr@hobbes ejr]$

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.141.6