Ctrl-Z on an SSH session
When I SSH into another system and press Ctrl-Z, I expected the SSH client to go into background. However, it's the remote process that does that. Where does the magic happen?
Solution 1:
The SSH client disables special key handling (stty -icanon -isig
options) for the local tty, so when you press CtrlZ, the client just reads the raw byte 0x1A
and forwards it to the server.
OpenSSH supports a special command to suspend the client – Enter, then ~, followed by CtrlZ.