Old keyboard with backspace key

Help! Backspace Doesn’t Work in the Linux Terminal

Backspace and Tab keys may not work correctly once you’re logged in remotely to a Linux system. This is how one can simply remediate this concern.


Old keyboard with backspace key

The Backspace key is not one thing you usually take into consideration an excessive amount of, however generally you may discover it does not work accurately within the terminal, particularly when logged in to a distant machine, echoing “^H” as an alternative of erasing what you have typed.

Happily, that is simple to repair with a easy command.

What Are These Bizarre Characters?

Chances are you’ll discover this drawback once you log in to distant machines over SSH, ones that run non-Linux Unix working techniques, notably proprietary techniques like Oracle’s Solaris. Quite a lot of older pc terminals used a distinct management character for Backspace than as we speak, utilizing “Ctrl + H.”

Trendy terminals use “Ctrl + ?” for Backspace. Most techniques will acknowledge the latter as Backspace lately as bodily terminals have largely been changed by terminal emulators on PCs, however you should still run into techniques that have not been upgraded and nonetheless anticipate “Ctrl + H.”

That is one purpose you will see previous Unix arms jokingly use “^H” in messages in the identical method folks use ironic strikethroughs to point “Oops, you were not presupposed to see that!” They could say one thing like “I really like Linux system mangling^H^H^H^H^H^H^Hadministration.”

Checking Terminal Settings with stty


Linux stty -a output in terminal

You may test what management characters the system makes use of with the stty command. The -a flag will give a human-readable output of the management characters.

MAKEUSEOF VIDEO OF THE DAY
stty -a

Search for the “erase” character. If it says “^H,” then it makes use of the older Backspace character. Happily, you can too repair this with the stty command.

Setting the Erase Character


Setting erase character with stty

You may set the erase character to the one your pc makes use of with this easy command:

stty erase '^?'

Do this and see if the Backspace key works accurately. You may put this within the shell’s startup file, akin to .bashrc for Bash and .zshrc for Zsh to have this set mechanically once you log into the system.

Associated: What Does Bash Imply in Linux?

Much like the Backspace key, you’ll be able to repair the problem utilizing the stty command if Tab does not work within the terminal.


Now Your Backspace Key Works within the Linux Terminal

Now that you have sorted out the Backspace key concern within the Linux terminal, you’ll be able to actually get to work.

In case you’re utilizing the terminal to log in to distant techniques, you may be much more productive with the mix of tmux and Mosh, letting you create classes that may maintain you linked endlessly.


muo-linux-remote-featured
Get Higher Distant Periods on Linux With Mosh and Tmux

Enhance your distant entry to Linux gadgets over SSH with Mosh and run a number of classes with Tmux.

Learn Subsequent


About The Creator

Leave a Comment

Your email address will not be published. Required fields are marked *