$ help suspend
suspend: suspend [-f]
Suspend shell execution.
Suspend the execution of this shell until it receives a SIGCONT signal.
How should I send a SIGCONT signal to a shell suspended by suspend
in a gnome terminal tab?
The same way as with any other suspended process: With fg
, %
, or any other similar job control builtin.
zsh% bash
bash$ suspend
zsh: suspended (signal) bash
zsh% jobs
[1] + suspended (signal) bash
zsh% fg
[1] + continued bash
bash$
fg
will only work in the case of a subshell (i.e., job suspended by the current shell). Also, suspend
will happily suspend the last shell in the chain without -f
if it isn't a login shell (as is the case with a normal (local) terminal emulator shell, which is how I tested my answer). Sending a SIGCONT
from another shell will work in both cases. (See my answer.)
Commented
Dec 2, 2015 at 7:52
suspend
ing the last shell, since it wasn't really important, so not worth adding a clarification and making the answer longer.
SIGCONT
The only way to resume the suspended shell is to send the SIGCONT
signal, presumably from another shell. You'll need to know the PID (process ID) of the shell.
kill -cont $shellpid
If you don't know the PID already, try this:
ps x | grep bash
For example, when I suspended my shell, I saw this with ps x | grep bash
:
6147 pts/14 S+ 0:00 grep --color bash
6172 pts/14 Ss 0:01 /bin/bash
15085 pts/0 Ss+ 0:00 /bin/bash
15121 pts/12 Ts+ 0:01 /bin/bash
Look at that third column. The shell you want is the one with the T
, and that one has a PID (first column) of 15121. Of course the PID in your case will differ; this was just an example. Once you find the PID (let's say it is 15121), then run:
kill -cont 15121
C-z
on my GUI emacs suspends it, but emacs shows up like this with ps aux | grep emacs
: gauthier 21308 0.5 1.3 453984 101564 ? Sl 15:03 0:07 /usr/bin/emacs
I'm not sure why it says Sl
and not T
?