Inserting a non printable character in a file

For some testing I want to insert a non printable character in a file. How to do it? I inserted ctrl-v ctrl-k through vi. But I do not think it is a proper non printable character.

Does ^K appear to be a single character on the screen (that is, when you move the cursor over it (in vi), does the cursor move only to the ^ or also to the K)?

catting the file will typically not show hidden characters. Use the -v option to see hidden characters.

1 Like

Yes ^K appears as a single character. Is there any way I can insert invisible control character?

That ^K in fact IS invisible when printed with normal methods.. You have to make it appear by special options like the -v to cat , or use commands built for that, like od .

1 Like