Server Fault is a question and answer site for system and network administrators. 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've got a series of production servers that I'd like to be able to run certain utilities on without having to SSH into the machine.

Unfortunately, some of those programs (top and iotop I've tried so far) require curses and/or a TERM environment variable to be set, and executing from the shell via SSH doesn't work:

$ ssh myserver top
TERM environment variable not set.
$ ssh myserver iotop
Traceback (most recent call last):
  File "/usr/sbin/iotop", line 16, in <module>
  File "/usr/lib/python2.7/dist-packages/iotop/", line 571, in main
  File "/usr/lib/python2.7/dist-packages/iotop/", line 561, in <lambda>
    main_loop = lambda: run_iotop(options)
  File "/usr/lib/python2.7/dist-packages/iotop/", line 465, in run_iotop
    return curses.wrapper(run_iotop_window, options)
  File "/usr/lib/python2.7/curses/", line 22, in wrapper
    stdscr = curses.initscr()
  File "/usr/lib/python2.7/curses/", line 33, in initscr
_curses.error: setupterm: could not find terminal

Any tips? Is this possible?

share|improve this question
up vote 6 down vote accepted

You say you want to run them without ssh, yet you connect over ssh. This makes very little sense :)

I'll assume you want to run utilities over ssh without starting a shell. That's possible, just make ssh allocate a PTY for you even if it doesn't start a shell:

ssh -t myserver top
share|improve this answer

For "top" you can use the "batch mode" - many tools have this too:

ssh myhost top -bn1
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.