10

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?

16

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.

| improve this answer | |
  • 3
    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.) – ctrl-alt-delor Sep 27 '12 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? – humanityANDpeace Oct 2 '19 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.