Home » Linux/Unix » How to Make Backspace Key Work in Linux/Unix Shell

How to Make Backspace Key Work in Linux/Unix Shell

It makes very irritating sometimes when we want to delete the previous character using backspace key in Linux/Unix and it shows characters like ^?  or ^] etc. instead of deleting the character. To get rid of this backspace key problem in Linux or Unix shell, use stty command to set the backspace key to erase the previous character.
The following is the example to set the backspace key to delete the previous character in shell, type stty erase then give two space and then press backspace and then press enter, your whole command will be something like this:
$ stty erase ^?
The above command will solve this problem but in some older versions of Linux and Unix you may need to run this command as following:
$ stty erase ^H
Backspace key problem solution for linux/unix