How to backspace or delete? How to backspace or delete? powershell powershell

How to backspace or delete?


The accepted answer works, but I thought I'd point out that if you launch bash rather than stay in sh then it all works so just type bash at the # prompt and you will get the functionality you require.


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.


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.