Name

^Z

Typing ^Z in a shell, while a job is running in the foreground, will suspend that job. It simply stops running, but its state is remembered:

sleep 20   Command that simply waits 20 seconds
^Z
[1]+  Stopped                 sleep 20
➜

Now you’re ready to type bg to put the command into the background where it continues running, or fg to resume it in the foreground.

Get Macintosh Terminal Pocket Guide 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.