Many developers rely on PuTTY for SSH connections to Linux servers, but occasionally encounter this frustrating behavior: when typing commands that exceed the terminal width, instead of proper line wrapping, new characters overwrite the beginning of the same line. This terminal display corruption can significantly impact productivity.
While the auto-wrap setting appears enabled in PuTTY's configuration, several factors could cause this malfunction:
- TERM environment variable misconfiguration (commonly set to 'xterm' when it should be 'xterm-256color')
- Server-side shell configuration issues in .bashrc or .profile
- PuTTY version compatibility problems
- Network glitches causing terminal control sequences to corrupt
First, verify your terminal environment variables:
echo $TERM
echo $COLUMNS
A proper setup should return something like:
xterm-256color
120
Option 1: Reset terminal dimensions
stty cols 120 rows 40
export COLUMNS=120
export LINES=40
Option 2: Force terminal reinitialization
reset
Option 3: Update PuTTY configuration:
- In PuTTY configuration, go to Window → Translation
- Set "Remote character set" to UTF-8
- Under "Terminal-type string", use "xterm-256color"
- Enable "Auto wrap mode" in the Terminal features section
Add these lines to your ~/.bashrc or appropriate shell configuration:
# Ensure proper terminal handling
if [ "$TERM" = "xterm" ]; then
export TERM=xterm-256color
fi
# Handle window resize
trap 'echo -ne "\e[8;${LINES};${COLUMNS}t"' WINCH
If issues persist, consider these PuTTY alternatives:
- Windows Terminal (with WSL integration)
- KiTTY (PuTTY fork with additional features)
- MobaXterm (for enhanced terminal handling)
For advanced troubleshooting, you can log raw terminal output:
script -t 2> timing.log -a output.session
# Reproduce the issue
exit
Then examine the raw control sequences in output.session for anomalies.
When working with PuTTY over SSH, you might encounter terminal display issues where:
- Long commands exceeding terminal width don't wrap properly
- Text overlaps existing characters at line start
- The cursor behaves erratically during input
Several factors can cause this behavior:
# Check terminal type in Linux
echo $TERM
# Verify terminal dimensions
stty size
# Examine TERMCAP settings
infocmp | grep -i am
First try these PuTTY settings adjustments:
- Window → Behaviour → "Auto wrap mode initially on" (enable)
- Window → Translation → Remote character set: UTF-8
- Window → Appearance → Font: Consolas or other monospace
On your Linux server, ensure proper terminal initialization:
# Add to ~/.bashrc
if [ "$TERM" = "xterm" ]; then
export TERM=xterm-256color
fi
# Reset terminal settings
reset
For persistent cases, check these server settings:
# Verify terminal capabilities
tput cols
tput lines
# Force terminal reset
tput reset
# Alternative terminfo setting
export TERM=linux
Create this diagnostic script to identify wrap issues:
#!/bin/bash
# termtest.sh - Terminal wrapping diagnostic
echo "Terminal width test:"
for i in {1..200}; do
echo -n "="
if (( i % $(tput cols) == 0 )); then
echo -n "\n"
fi
done
echo
If issues persist, consider these PuTTY alternatives:
- Windows Terminal with SSH
- MobaXTerm
- KiTTY (PuTTY fork with better wrapping)
Run these commands to verify environment:
# Check for missing terminfo
find /usr/share/terminfo -name "xterm*"
# Test with minimal config
env -i TERM=xterm bash --noprofile --norc