Questions tagged [control-characters]

Use this tag for questions about control characters – non-printing characters used to send signals to the output terminal.

Control characters are non-printing characters that are used to send signals to the output terminal.

There are 33 control characters defined in ASCII, whose corresponding hex numbers are
0x00 – 0x1f (0-31 in decimal) and the control character DEL with hex number 0x7f (127 in decimal).

More information about control characters at Wikipedia.

26 questions
13
votes
1 answer

Why do ^M and \r behave inconsistently?

Perhaps there are already answers out there that indirectly answer my question, but I've read many of them and haven't yet found a satisfactory answer to this discrepancy. The original meaning of carriage return comes from old teleprinters: it meant…
13
votes
4 answers

Determine how long tabs '\t' are on a line

In a text processing field is there a way to know if a tab is 8 characters in length (the default length) or less? For example, if I have a sample file with tab delimiter and the content of a field fit in less than one tab (≤7), and if I have a tab…
αғsнιη
  • 40,939
  • 15
  • 71
  • 114
7
votes
1 answer

gnome-terminal: strange control characters on Alt key

I probably misconfigured something, but I don't know what. (see UPDATE 1 and 2 below) In gnome-terminal, when I hit Alt (without any other key), it immediately sends ^[< to the terminal (I tested by hitting Ctrl+V before Alt). Since I use Alt+Tab a…
Stuck
  • 151
  • 7
5
votes
1 answer

`cat -v` for non-printing non-ascii UTF characters

cat has a -v option which converts non-printing characters to their caret notation (which is useful if we don't want the terminal to interpret the control characters literally in cat output). But as I understand, the caret notation only applies…
flow2k
  • 561
  • 1
  • 8
  • 19
5
votes
2 answers

When will an interactively typed backspace be passed as input?

I just noticed that I've seen different behavior across different systems when creating a quick test file (e.g. with sample input) via cat and redirection. Here are the steps to see what I'm talking about: Run cat > testfile. Type in helli, then…
Wildcard
  • 35,316
  • 26
  • 130
  • 258
4
votes
3 answers

How to find control characters in a file?

I want to find what control characters are in my file. I do not search for specific character, but it is possible \t or \n. I have a program that is telling me: Invalid control character. But when I open the file I do not see anything. How to show…
user9371654
  • 811
  • 4
  • 17
  • 32
2
votes
0 answers

Apply control charactes to file reddirect

Tried various existing answers, but didn't find any which entirely works. This is one line example, and show how it fails, maybe some extra switch or step can solve this? This is the content of file I am trying to save to txt file with control…
watbywbarif
  • 131
  • 3
2
votes
1 answer

What can the C1 control codes be used for?

Today I discovered that there is a significantly large group of additional control codes, called C1 control codes, spanning from U+0080—U+009F (32 characters). I think that it's an interesting fact that there is such a large part of the single-byte…
2
votes
2 answers

How can I change CMD to CTRL in Linux Mint only in Terminal?

I installed Linux Mint on my MacBook Air, and I prefer to use Cmd for copying/pasting, opening and closing windows, and general things like that. However, I would like to use Ctrl to input to the Terminal. So, pressing Ctrl+C would terminate…
2
votes
1 answer

screen logging - How to ommit interactive shell control characters and prompt?

One of my first questions. Please comment if further explanation or information is required or if the question is not like it's supposed to be here I'm using screen to automatically start servers (minecraft server in this example). I'm spawning a…
2
votes
1 answer

tmux: backspace and ctrl-backspace send both ^?

With FreeBSD 11.1 and tmux 2.7, pressing ← (backspace) sends ^? and ctrl+← does also send ^?. The default behavior (no tmux) is: ^H for ← ^? for ctrl+← How can I get this default behavior with tmux? Or at least achieve that ← and ctrl+← don't…
viuser
  • 2,564
  • 3
  • 29
  • 57
2
votes
0 answers

Show colors from child shell in parent shell

I solved this once, but I cannot remember how I did! In my child process, I have this: echo -e "some control chars" In my parent process, it will show the plain string, without any terminal styling. Isn't there some way to interpret the control…
Alexander Mills
  • 9,330
  • 19
  • 95
  • 180
1
vote
3 answers

Where are the characters going?

In a shell where \u is valid (bash +4.3, ksh93 or zsh) we can print Unicode characters: $ printf 'a b c \ua0 \ua1 \ua2 \ua3 \n' a b c ¡ ¢ £ Which are some characters from the Latin-1_Supplement range. However as soon as an Unicode 9fcharacter is…
QuartzCristal
  • 1,963
  • 3
  • 23
1
vote
2 answers

color codes messing up table formatting of printf to xterm

My script-in-progress displays a multi-column colorized table, but the color-codes are interfering with the formatting. The color codes cannot be moved to the format string because the coloring of some columns is variable from row to row. No…
Mic
  • 11
  • 2
1
vote
2 answers

Multi-file multi-directory removal of ^@

I have multiple files in multiple subdirectories where I need to remove all instances of the control character "^@". Just a basic grep doesn't seems to be working. This what I've tried most recently. grep -rl '\^@' ./ | xargs sed -i…
Bryan
  • 13
  • 2
1
2