Help! Backspace Doesn’t Work in the Linux Terminal

Backspace and Tab keys might not work properly when you’re logged in remotely to a Linux system. Here’s how you can easily remediate this issue.

The Backspace key isn’t something you normally think about too much, but sometimes you might find it doesn’t work correctly in the terminal, especially when logged in to a remote machine, echoing «^H» instead of erasing what you’ve typed.

Fortunately, this is easy to fix with a simple command.

What Are These Weird Characters?

You may notice this problem when you log in to remote machines over SSH, ones that run non-Linux Unix operating systems, particularly proprietary systems like Oracle’s Solaris. A lot of older computer terminals used a different control character for Backspace than today, using «Ctrl + H

Modern terminals use «Ctrl + ?» for Backspace. Most systems will recognize the latter as Backspace these days as physical terminals have largely been replaced by terminal emulators on PCs, but you may still run into systems that haven’t been upgraded and still expect «Ctrl + H

This is one reason you’ll see old Unix hands jokingly use «^H» in messages in the same way people use ironic strikethroughs to indicate «Oops, you weren’t supposed to see that!» They might say something like «I love Linux system mangling^H^H^H^H^H^H^Hadministration.»

Checking Terminal Settings with stty

You can check what control characters the system uses with the stty command. The -a flag will give a human-readable output of the control characters.

MAKEUSEOF VIDEO OF THE DAY
stty -a

Look for the «erase» character. If it says «^H,» then it uses the older Backspace character. Fortunately, you can also fix this with the stty command.

Setting the Erase Character

You can set the erase character to the one your computer uses with this simple command:

stty erase '^?'

Try this and see if the Backspace key works correctly. You can put this in the shell’s startup file, such as .bashrc for Bash and .zshrc for Zsh to have this set automatically when you log into the system.

Related: What Does Bash Mean in Linux?

Similar to the Backspace key, you can fix the issue using the stty command if Tab doesn’t work in the terminal.

Now Your Backspace Key Works in the Linux Terminal

Now that you’ve sorted out the Backspace key issue in the Linux terminal, you can really get to work.

If you’re using the terminal to log in to remote systems, you can be even more productive with the combination of tmux and Mosh, letting you create sessions that can keep you connected forever.

Get Better Remote Sessions on Linux With Mosh and Tmux

Improve your remote access to Linux devices over SSH with Mosh and run multiple sessions with Tmux.

Read Next

About The Author

Servicio técnico Teveo Tecno

Entradas recientes

Cómo reiniciar los Joy-Cons de Nintendo Switch

Cuando tus Joy-Cons empiezan a dar problemas de conexión, reiniciarlos es tu mejor opción. La…

2 años hace

¿Safari sigue fallando en el Mac? 5 formas de solucionarlo

Safari es el navegador preferido por casi todos los usuarios de Mac. Funciona bien y…

2 años hace

7 formas útiles de utilizar la aplicación de accesos directos en tu Mac

Si eres un usuario de Mac relativamente antiguo, puede que no te hayas dado cuenta…

2 años hace

¿Debes actualizarte a macOS Ventura? Así es como se decide

macOS Ventura está repleto de increíbles funciones y mejoras, como Stage Manager, Continuity Camera, Freeform…

2 años hace

6 formas de solucionar el error de SSD no reconocido en Windows 10

Las unidades de estado sólido (SSD) tienen enormes ventajas sobre los discos duros magnéticos tradicionales,…

2 años hace

7 maneras de arreglar las imágenes que no se cargan en Google Chrome

Aunque Google Chrome es uno de los navegadores web más populares, no está libre de…

2 años hace