I thought of playing around a bit with find -fprintf. In case you don't know what -fprintf does, it is the same as -printf but writing to a file you specify its name.
Now, when I run a command like this:
find -maxdepth 1 -type d -fprintf output "%p\b\n"
I get the following in output (using vim and pretty much any text editor):
.^H
./directory-1^H
./directory-2^H
./directory-3^H
I understand that ^H is the backspace character. Opening output with less:
./directory-
./directory-
./directory-
So, the question is:
- Why do
vimand other text editors (triednano, andemacs) display the backspace without interpreting it by removing the character before it butlessdoes? - Why don't the editors print a character for
\ninstead of going down for a new line? - What is the difference between printing a backspace and hitting backspace on the keyboard (a character gets actually deleted on hitting backspace on the keyboard)?
I'm running this on my machine (laptop) without sshing anywhere. Using GNU/Linux Ubuntu 16.04 LTS with konsole and tmux.