Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I use PuTTY to connect to a specific Linux server via the SSH protocol, and I try to edit a file using the nano editor, the "enter" does not update the display. When I press enter to insert another line break, the following lines do not move down. However, if I save the file and re-open it, the new line breaks are there.

I have further discovered that this only occurs on the first 3-4 lines of the file.

This particular server runs CentOS 6. When I connect to a different server, I don't have the same problem.

Where does the problem lie and how do I fix it?

Running infocmp $TERM reports:

#       Reconstructed via infocmp from file: /usr/share/terminfo/l/linux
linux|linux console,
    am, bce, ccc, eo, mir, msgr, xenl, xon,
    colors#8, it#8, ncv#18, pairs#64,
    acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376,
    bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l\E[?1c,
    clear=\E[H\E[J, cnorm=\E[?25h\E[?0c, cr=^M,
    csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C,
    cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, cvvis=\E[?25h\E[?8c,
    dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM,
    dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,
    flash=\E[?5h\E[?5l$<200/>, home=\E[H, hpa=\E[%i%p1%dG,
    ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL,
    il1=\E[L, ind=^J,
    initc=\E]P%p1%x%p2%{256}%*%{1000}%/%02x%p3%{256}%*%{1000}%/%02x%p4%{256}%*%{1000}%/%02x,
    kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B,
    kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\E[[A,
    kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~,
    kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~,
    kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, kf20=\E[34~,
    kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~,
    kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~,
    kmous=\E[M, knp=\E[6~, kpp=\E[5~, kspd=^Z, nel=^M^J, oc=\E]R,
    op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E[10m,
    rmam=\E[?7l, rmir=\E[4l, rmpch=\E[10m, rmso=\E[27m,
    rmul=\E[24m, rs1=\Ec\E]R, sc=\E7, setab=\E[4%p1%dm,
    setaf=\E[3%p1%dm,
    sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m,
    sgr0=\E[0;10m, smacs=\E[11m, smam=\E[?7h, smir=\E[4h,
    smpch=\E[11m, smso=\E[7m, smul=\E[4m, tbc=\E[3g,
    u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?6c, u9=\E[c,
    vpa=\E[%i%p1%dd,
share|improve this question
    
Sounds like a termcap/terminfo problem. What does echo $TERM show. Also, the output of infocmp $(echo $TERM) might be helpful. –  penguin359 Mar 2 '12 at 18:50
    
@penguin echo $TERM reports linux. –  Travis Beale Mar 2 '12 at 18:57
    
@penguin359 infocmp $TERM would do. –  Gilles Mar 2 '12 at 22:59
    
@Gilles yes, I was thinking too hard on that one. –  penguin359 Mar 2 '12 at 23:05
add comment

2 Answers

I am a little confused by the statement running "PuTTY over ssh". I assume you mean using PuTTY to connect to a Linux server via the SSH protocol (sorry, it's so wordy, just want to clarify). When using PuTTY, TERM should always be xterm as PuTTY (and many other graphical terminals) emulate the old xterm Terminal Emulator. The TERM value Linux implies you are running directly at a Linux text console without X11/Xorg running. The TERM value for PuTTY is normally set under PuTTY Configuration -> Connection -> Data -> Terminal-type string. It should always be set to xterm. The other possibility is that a login script like .bashrc, .profile, .cshrc, etc. is setting TERM when you log into the faulty server. If TERM is still set to Linux, try running this at the command-line:

export TERM=xterm

If that fixes the problem with nano, you might have to track down with login script is setting it. A login script should never have to set TERM as that is normally handled by getty/sshd ahead of time.

share|improve this answer
    
You are correct in your interpretation of my question. I edited the question using your unambiguous phrasing. –  Travis Beale Mar 2 '12 at 20:02
add comment
up vote 2 down vote accepted

I found the problem by comparing my saved session in PuTTY for the "problem" server to one for a "working" server. Under the terminal emulation options, I had "DEC Origin Mode initially on" checked. Unchecking this option solved the problem.

share|improve this answer
1  
Glad it's working! Never had a chance to play with that setting yet, too many other ones (like nethack) to play with. I'm also a little worried about TERM showing linux instead of xterm. Did you determine why that was happening? –  penguin359 Mar 2 '12 at 20:30
add comment

Your Answer

 
discard

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.