Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to backspace or delete?

In Windows 10, when I launch MS PowerShell to ssh through a container in Kitematic at windows, I've noticed that I can't backspace or delete, instead I get ^H for backspace instead of actually delete previous character.

Do I miss something?

like image 275
simo Avatar asked Jan 02 '16 12:01

simo


People also ask

Is Backspace the same as delete?

The keyboard key used to delete the text character at, or to the right of, the screen cursor. Pressing Delete (DEL) also deletes the currently highlighted text, image or group of images. The Delete key removes characters to the right of the cursor, whereas the Backspace key deletes to the left.


2 Answers

The temporary solution is set the tty erase command to whatever your backspace key sends in the terminal, when connected via ssh.

stty erase ^H

The ^H sequence above is not the literal text but a control character entered by pressing ctrl-v and then backspace.

You can add this command to your .bashrc file on the docker VM to have it set automatically each time you connect. When editing the file in a terminal you have to enter the string with the same escape sequence as above.

Doing this in .bashrc will set erase for all logins to the VM so you may negatively impact the way erase works for other terminal types that connect.

You would normally fix this on the client side rather than the server. For example, PuTTY has a specific setting for this. I'm not sure why your powershell/ssh combo doesn't have erase mapped correctly as Docker normally works out of the box. Check what your Docker shortcuts do when launching the docker/ssh terminal and do the same when you launch your terminal to manually connect.

like image 189
Matt Avatar answered Sep 19 '22 13:09

Matt


In case someone stumbles on this at this late stage - similar situation - using MS POWERSHELL openSSH implementation. Remoting into AIX / ksh.

Had to set TERM to vt100 (edited .profile) to get vi to work in a way that was not aggravating:

TERM=vt100  
EXPORT TERM

And then added this line to my .profile.

stty erase '^?' echoe

erase '^?' takes the backspace provided by windows ssh.

echoe forces the edit to show up on the screen.

without echoe I would type

$123456[backspace][backspace][backspace][backspace][enter]  

$12 is not recognized as a command

on the entry line - each backspace appended to the line with a little question mark in a box.

like image 45
Robert Clayton Avatar answered Sep 20 '22 13:09

Robert Clayton