5

I just stumbled upon a weird problem. When I SSH into my server (centos, zsh) and I type some stuff and hit backspace It looks like a space - but internally it really deleted the characters.

ls -l a

Note that the space between land a is actually when I hit backspace. When I now hit return ls -a gets executed. This is only in zsh, in bash it works fine.

Hope anyone has an idea what this is all about and how to fix this.

Update: Only happens when using tmux/screen

I also cannot clear the screen:

helium:~% echo $TERM
screen-256color
helium:~% clear
'screen-256color': unknown terminal type.

1 Answer 1

6

That's unusual. I'd start by seeing whether Ctrl-L works (ie, zsh knows your terminal and can issue a clear-screen) and running echo $TERM to see what terminal type zsh received from Terminal.app; I have Terminal.app send xterm-color and that seems to be portable and accepted.

Another thing to check is what happens when you type Ctrl-H, but I thought that all modern systems had settled on 0x7F for backspace.

[post-update with screen information:]

Bash has more built-in hacks for assuming that missing terminal types are ANSI-ish, but your root problem is that the $TERM is unrecognised. This will break most apps that want to issue control directives to the terminal emulator. Override $TERM in your ~/.zprofile:

case ${TERM} in
  screen-256color) TERM=screen.xterm-xfree86
  ;;
esac

This is part of the problem of termcap/terminfo -- it relies upon everyone having the same names, everyone being updated, etc. No negotiation is done.

6
  • Updated my post. This behaviour is only when using tmux/screen. In tmux Ctrl-L does not work properly and Ctrl-H doesn't do a thing. Added some more infos to my intro post.
    – nocksock
    Jan 5, 2011 at 10:55
  • Updated my answer, Nils' comment above applies to the first 2 paragraphs of my text.
    – Phil P
    Jan 5, 2011 at 11:06
  • in which .zprofile? On my local machine or on the server? :)
    – nocksock
    Jan 5, 2011 at 11:36
  • On the server since that's the Linux box with that particular terminfo entry; or in your ~/.zshrc of the local machine you could just override $TERM to something more portable. Or use the term directive inside ~/.screenrc.
    – Phil P
    Jan 5, 2011 at 11:42
  • (ahem: the server is the Linux box missing that particular terminfo entry; sorry for any confusion)
    – Phil P
    Jan 8, 2011 at 23:48

You must log in to answer this question.

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