Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As I recall, ^H means Backspace. I generated it by pressing CTRL+V, CTRL+H.

So the ^H should remove the last character, as it is the same as Backspace and it should act just as if I pressed Backspace at this position.

Why the does the output of echo abc^H remain abc and not ab?

share|improve this question
^H means "cursor left one". – Ignacio Vazquez-Abrams May 2 '12 at 23:33
up vote 16 down vote accepted

backspace is only moving the cursor backward.

backspace (or delete or whatever character depending on the configuration) deletes the last printed character only when these conditions are met:

  • it is typed on the keyboard, not a command output like echo in your example
  • the terminal device is in cooked mode (the usual case)

If you want to erase the c in your example, you need to overwrite it by another character, for example:

echo "abc^H "
share|improve this answer
Btw even echo "abc^H " didn't work for me, however echo -e "abc\b " did. I can't figure out why ^H doesn't work. ps. My shell is bash 4.1.5 . – rush May 3 '12 at 7:48
@Rush: Make sure you enter ^H by typing Ctrl-V, Ctrl-H – jlliagre May 3 '12 at 8:44
Oh, thanks. That trick works great :) – rush May 3 '12 at 9:57

stty erase ^H that should solve it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.