myhost$ ssh remhost
Last login: Fri Dec 22 09:08:31 2000 from myhost
NetBSD 1.4.2A (GENERIC) #6: Wed May 31 06:12:46 EST 2000
remhost%
remhost% ~CTRL-z
[1]+ Stopped ssh remhost
myhost$
Notice the extra prompt: it shows me pressing ENTER first, before
typing the tilde. That isn't necessary if you
pressed ENTER to complete the previous command line -- but I tend
to do it all the time, "just in
case" I didn't type that ENTER.
You can stop the remote session in the middle of an interactive job,
like using a text editor. But I'd recommend getting
to a shell prompt on the remote system first, if you can. (For
example, stop the remote job with CTRL-z so you'll
get a shell prompt on the remote system.) Otherwise, if you bring the
remote session into the foreground while you're in
the middle of a full-screen editing job there, for example, the
remote system won't know that it's
supposed to redraw the screen when you come back online. Worse, if
you forget where you were on the remote system, you might type a key
that could do something disastrous, like deleting lines of the file
you're editing. Stopping and starting from a known
point -- a shell prompt -- is the best way
I've found.