You are here: >

Linux and Unix wait command

wait commandAbout wait
wait syntax
wait examples
Related commands
Linux and Unix main page

About wait

wait is a built-in shell command which waits for a given process to complete, and returns its exit status.

wait syntax

wait [pid] [jobid]

Description

wait waits for the process identified by process ID pid (or the job specified by job ID jobid), and reports its termination status. If an ID is not given, wait waits for all currently active child processes, and the return status is zero. If the ID is a a job specification, wait waits for all processes in the job's pipeline.

pid The unsigned decimal integer process ID of a command, for which the utility is to wait for the termination.
jobid A job control job ID that identifies a background process group to be waited for. The job control job ID notation is applicable only for invocations of wait in the current shell execution environment, and only on systems supporting the job control option.

wait examples

wait 2017

Wait for process 2017 to terminate, and return its exit status.

csh — The C shell command interpreter.
jobs — List the status of all running jobs.
ksh — The Korn shell command interpreter.
sh — The Bourne shell command interpreter.