Linux – Getting ‘top: Unknown terminal “dumb” in $TERM’ in Linux

linuxssh

I'm getting this error whenever executing the top command in Linux remotely via SSH:

top: Unknown terminal "dumb" in $TERM

My Java application which monitors the performance of the remote machine uses the output of top command.

How can I fix this problem?

Best Answer

Try passing the -b option to top. From the manual:

b Batch mode. Useful for sending output from top to other programs or to a file. In this mode, top will 
  not accept command line input. It runs until it produces the number of iterations requested with the n 
  option or until killed. Output is plain text suitable for display on a dumb terminal.
Related Question