Checking Job Status

The status and other information about all jobs is displayed using the jobs command. The following jobs output shows that there is one stopped job, and two running jobs. The + indicates the current job, and indicates the previous job:

					$ jobs
					[3]  + Stopped            split —5000 hugefile
					[2]  — Running            find / —name core —print &
					[1]    Running            sleep 25 &
				

The jobs –l command shows the same information, along with the process ids, while jobs –p only gives you the process ids.

					$ jobs —l
					[3]  + 466 Stopped split —5000 hugefile
					[2]  — 465 Running find / —name core —print &
					[1]    463 Running sleep 25 &
				

Killing Jobs

Stopped or background jobs are terminated with the kill command. Unlike bg or fg, a job argument must be given. Here, a sleep

Get Korn Shell: Unix and Linux Programming Manual, Third Edition, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.