From Linux Bash Shell Scripting Tutorial Wiki
Jump to navigation Jump to search

The suspend is a bash built in command. It is used to suspend the execution of this shell until it receives a SIGCONT signal. Unless forced, login shells cannot be suspended. This command is equivalent of pressing Ctrl+Z in your shell. See example below for more info.


The syntax is:

suspend [-f]

The -f option force the suspend, even if the shell is a login shell.


Type the following command to become a root user:

$ sudo -i

Now run command as root user:

# date
# id

Suspend shell execution of 'sudo -i' command:

# suspend -f

You are now back to normal shell:

$ id

To move suspended (sudo -i) job to the foreground use fg:

$ fg