@ralphbsz has kindly explained what they are, but to get rid of them you will need to tell us which shell you are running. Then you can put some code into your shell initialisation file to prevent what you're seeing from happening.What are they? are they a relic of the past?
You cannot get rid of them in general, short of disabling your keyboard altogether. For example, at the shell prompt, try pressing
F12(depends on the shell). You will most likely see strange combinations of numbers and other characters appear. This is the way “escape sequences” work.
catat the shell prompt, you can see the sequences generated by various special keys.
I think "most" shells and editors come with sensible default key bindings for "most" keys these days, out of the box. So in practice, you should see very few escape sequences, unless special characters (like Control V) or garbled sequences show up. The only problem with that statement is that I said "most": I just tried it on my 12.2 machine with bash, tcsh, and emacs, and they do mostly sensible things, or ignore unknown keys. But that leaves lots of other shells and programs that are probably not as well configured.Fair point. I was thinking more along the lines of the characters that appear when you hit the delete key (for example) without previously having mapped that keystroke using
everyone, i was simply curious of what they were, i have no desire to remove them, they do not bother me or get in the way
thanks, that makes senseTypically terminal control escape sequences. Example (here for bash, a similar version works in tcsh): Type Control V, and then a cursor right key. What you will see on the screen is "^[[C". Here's why: When you press the cursor right key, the terminal (emulator) actually emits the control sequence Esc [ C. That's because terminals emit the ASCII code of the key that is pressed (for example "a" = 0x61 when you hit the lowercase a key). But there are no ASCII codes for most of the function keys on the keyboard, only for the "displaying" characters. So those function keys like cursor control, the F-keys and the block of 6 keys above the cursor control keys emit escape sequences, a set of characters that starts with the Escape character. And the shell knows to not echo those to the screen, but take an action based on them.
When you press Control V, you are telling the shell: Take the next character that you see literally, as if I had typed it, and put it into the command line. That removes the Escape from "cursor right", leaving the "[C". And since Escape is echoed by the shell as "^[" (since it is really is Control-opening-square-bracket), you see "^[ [ C".
The same works the other way. When emacs or vi do complicated drawing on the screen, they use lots of complicated escape sequences. For example: Esc [ 31 m means: Print the next text in red. Esc [ H means: start drawing at the beginning (top left corner) of the screen. And so on. If you confuse the terminal emulator (for example by printing another escape character, or putting it into a strange mode), sometimes these escape sequences that are being sent to the terminal become visible.
If you want to figure out what these escape sequences are, search the web for "ANSI vt100 escape sequences" or something like that.