“...I've been working since 2008 with Ruby / Ruby on Rails, love a bit of Elixir / Phoenix and learning Rust. I also poke through other people's code and make PRs for OpenSource Ruby projects that sometimes make it. Currently working for InPay...”

Rob Lacey (contact@robl.me)
Senior Software Engineer, Brighton, UK

xterm-256color: unknown terminal type

Trying to run `top` on an Ubuntu server from OSX Mountain Lion results in the following.

root@server:~# top
'xterm-256color': unknown terminal type.

Thanks to Corentin Leclerc for the solution http://blog.corentinleclerc.com/terminal-sur-macos-x-lion-xterm-256color-unkn

Add the following to ~/.profile or ~/.bash_profile

export TERM="xterm"

Restart your terminal, or open a new tab. Magic.

root@server:~# top

top - 10:52:46 up 31 days, 16:34,  1 user,  load average: 0.04, 0.02, 0.00
Tasks:  57 total,   1 running,  56 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    786652k total,   772360k used,    14292k free,   181920k buffers
Swap:        0k total,        0k used,        0k free,    46000k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                                                              
26479 rails     20   0 89604  57m 2428 S  0.3  7.5   0:04.08 ruby1.8                                                                                                                                                                                               
    1 root      20   0  1952  508   72 S  0.0  0.1   0:13.04 init                                                                                                                                                                                                  
    2 root      15  -5     0    0    0 S  0.0  0.0   0:00.12 kthreadd