Name

suspend

The built-in command suspend will suspend the current shell if possible, as if you’d typed ^Z to the shell itself. For instance, if you’ve run the sudo command to make an administrator shell (see Becoming the Superuser) and want to return to your original shell:

whoami
smith
➜ sudo bash
Password: *******
# whoami                “#” is the superuser prompt
root
# suspend
[1]+  Stopped                 sudo bash
➜ whoami
smith

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.