Linux provides a printf command through which we can format what we want to output.

New line

1
printf '\n'
img

Prints a new line

Double quote

1
printf '\"\n'    # Follow by a new line, so we can see the double quote clearly.
img

Prints a double quote

Backslash

1
printf '\\\n'    # Follow by a new line, so we can see the backslash clearly.
img

Prints a backslash

Alert bell

1
printf '\a'
img

Echos a bell sound

Backspace

1
printf 'ab\bc\n'    # This removes the character b
img

Backspace a character

Escape

1
printf 'a\ebc\n'    # This removes the character b
img

Backspace a character

Form Feed

1
printf 'a\fbc\n'    # This switch the screen to a new page and prints bc follow by a new line.
img

Before switching to a new screen page

img

After switching to a new screen page

Carriage Return

1
printf '\r'    # This presses the enter key
img

Presses the enter key

Horizontal Tab

1
printf '\t'    # This prints a horizontal tab
img

Prints a horizontal tab

Vertical Tab

1
printf '\v'    # This prints a vertical tab
img

Prints a vertical tab

Octal Value

1
printf '\501\502\503\n'    # This prints octal values
img

Prints octal values

Hexadecimal Value

1
printf '\x41\x42\x43\n'    # This prints hexadecimal values
img

Prints hexadecimal values

Unicode Character

Four Digits

1
printf '\u0041\u0042\u0043\n'    # This prints four digits unicode characters
img

Prints four digits unicode characters

Eight Digits

1
printf '\U00000041\U00000042\U00000043\n'    # This prints eight digits unicode characters
img

Prints eight digits unicode characters

References PRINTF(1), PRINTF(3), 15.2 printf: Format and print data

Buy me a coffeeBuy me a coffee