Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm connecting to a server via ssh to send a message using a command like:

ssh 181.169.1.2 -p 5566

After the connection is established and i write the message and send it i can't exit the text mode. I'm only allowed to enter more text and that's it. Is there a command or a key combination that allows me to return to command mode?

share|improve this question
1  
The example you give has nothing to do with messages. You are connecting to a host with SSH to a non standard port. In most cases you will get a shell. If the server is configured to use a special texting program as a login shell you need to give us more details. –  Matteo Aug 28 '12 at 15:26
1  
what you call text mode and command mode, is unclear, as there are no such modes. so perhaps you should use screenshots to explain what you see and what you expect, and not try to use terms of your own making which sound great but have nothing to do with ssh. –  barlop Aug 28 '12 at 15:29
    
Thank you for your answers! @Matteo I've implemented a channel socket server and i wanted to test it before implementing the client, but since i'm new to Linux, i didn't know that ssh can't be used like telnet in this case, because it simply has other purpose. Barlop, sorry for the ambiguous terms i have used, "text mode" something where you add text until you enter an escape character, "command mode"~= everything else after you enter the escape character. –  Andreea Aug 29 '12 at 6:41
add comment

5 Answers

up vote 12 down vote accepted

SSH Escape Character

Most SSH implementations implement an escape character for interactive sessions, similar to telnet's Ctrl-] combination. The default SSH escape character is ~, entered at the beginning of a line.

If you want to terminate an interactive OpenSSH session which is stuck and cannot be exited on the remote side, you can enter ~ followed by a dot .. To be sure to enter the escape character at the beginning of an input line, you should press Enter first. So the following sequence will in most cases terminate an SSH session:

<Return> ~ .

Other Escape Sequences

OpenSSH, for example, offers other escape sequences besides ~.. Entering ~? during a session should give you a list. Some examples:

  • ~ followed Ctrl-Z suspends the session,
  • ~& puts it directly into background,
  • ~# gives a list of forwarded connections in this session.
  • If you want to simply enter a tilde at the beginning of a line, you have to double it: ~~.

The escape character can be changed using the command line option -e. If you set the special value -e none, escaping is disabled and the session is fully transparent.

See also the OpenBSD man page on ssh (which is referenced from www.openssh.org) under the -e command line option

share|improve this answer
add comment

Do you want to exit the SSH shell?

You can type exit and hit Enter, or use Ctrl+D

share|improve this answer
    
"exit" helped me as ctrl+d not worked in VNC viewer...thanks –  raj gupta Jun 10 '13 at 7:57
add comment

Just type exit or logout (and hit Enter of course) both will work

share|improve this answer
add comment

You can write logout in the console line (and hit Enter of course).

share|improve this answer
add comment

i managed to exit by simply closing the terminal(little x in corner), but im new at this so im yet to find out if this is the wrong way. i hope not.....

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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