Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

I directly start a remote script/command on an Ubuntu server with the following command:

ssh me@server 'nano my_file.txt'

However, this throws an error:

Error opening terminal: unknown.

Another example, calling a remote script which contains the nano command from above gives the same error.

ssh me@server ''

When I do ssh me@server 'echo something', I get something as expected.

What is wrong?

share|improve this question
up vote 5 down vote accepted

You would have to use the -t flag.


 ssh -t me@server 'nano my_file.txt'
 ssh -t me@server ''

Explanation from man ssh:

 -t      Force pseudo-tty allocation.  This can be used to execute arbi‐
         trary screen-based programs on a remote machine, which can be
         very useful, e.g. when implementing menu services.  Multiple -t
         options force tty allocation, even if ssh has no local tty.
share|improve this answer

Your Answer


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.