I typed help suspend
and got this short explanation:
suspend: suspend [-f]
Suspend shell execution.
Suspend the execution of this shell until it receives a SIGCONT signal.
Unless forced, login shells cannot be suspended.
Options:
-f force the suspend, even if the shell is a login shell
Exit Status:
Returns success unless job control is not enabled or an error occurs.
How I understand this is: I type suspend
and the terminal freezes, not even strg + c can unfreeze it. But when I open another terminal and search for the PID for the frozen one and type kill -SIGCONT PID-NR
a SIGCONT signal is send to the frozen terminal and thaws it up, so that it gets unfrozen.
But, what is the actual purpose of suspending a terminal? Which every day applications are typical for it? What did the people who made it a shell builtin have in mind?
Best Answer
If you start a shell from another shell, you can suspend the inner one. Say when using
su
, and wanting to switch back to the regular user for a moment:(If you do that, don't forget the privileged shell open in the background...)
Similarly, if you escape to a shell from some other program (the
!
command in e.g.less
), you can still suspend the shell. But I wouldn't expect many other programs to handle it nicely when they launch a subprocess, which then suspends itself.