Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In a (SSH) terminal session, what is the purpose of the mode started by the key sequence apostrophe <ENTER> or more literally '<ENTER>.

What is the way to exit that mode?

share|improve this question
You mean that you type ' then enter, and are wondering what's happening? – Mat May 20 '12 at 9:27
Yes. I will edit to clarify. – H2ONaCl May 20 '12 at 9:38
There actually is a "special SSH command mode" that is started by default ~ followed by newline. See the "Escape characters" section in man ssh. I'm guessing this is not what you are seeing here, though. – Daniel Andersson May 20 '12 at 12:33
up vote 5 down vote accepted

Typing 'enter doesn't start any special SSH mode. The (normal) commands you type are interpreted by the shell on the other end of your SSH connection, not SSH itself.

' is usually called a single quote in shell terminology, " a double-quote, and ` is a backtick.

' starts a character sequence that is not interpreted by the shell. This is useful, for example, if you need to pass and argument to a program the must contain $ or another character sequence the would otherwise be interpreted by the shell, or that contains newlines. You end that sequence with another '.

" is similar, but some interpolation happens (i.e. variables are expanded).

` is different. That's for command substitution. If you type

echo `foo`

the output of running the foo program is substituted before running the echo command. Another way of doing that is by using $(...):

echo $(foo)

So if you type 'enter, you're just starting a multiline literal string. You end that either with a matching ', or with CtrlC if you want to break out.

$ echo 'hello
> this
> is 
> a
> multiline
> string
> '
$ echo 'foo $PWD'
foo $PWD               # no interpolation
$ echo "foo $PWD"
foo /tmp               # interpolation

Starting a line with a ' isn't really useful by itself.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .