Job Names

Most people use the job number to refer to a job, because one number is easy to remember. However, jobs can be referred to in a number of other ways: by process id, current/previous job, or all or part of a job name. If we had these jobs:

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

then the split job could be referred to as %3, %+, %%, 466, %split, or %?sp, the find job could be referred to as %2, %–, 465, %find, or %?f, and the sleep could be referred to as %1, 463, %sleep, or %?sl.

Table 5.2. Job Names
%n job n
%+, %% current job
%– previous job
%string job whose name begins with string
%?string job that matches part or all of string

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.