11

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?

1 Answer 1

19

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.

2
  • 4
    At begining of line type ~? to get a full list of escape codes. You can change the escape character using -e when you start ssh. (this applies to openssh, used on most Gnu systems.) Sep 27, 2012 at 22:31
  • I expected the local ssh client to be suspended, not the process on the remote machine. Is there a reason why the ordinary Ctrl-Z is modified instead of a new ~ Ctrl-Z being added for stopping the remote process? Oct 2, 2019 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.