How do I type carriage return?

How do I type a carriage return control character, in Windows or in Linux?

I'd like to type a backspace character too.

http://en.wikipedia.org/wiki/Control_character


Solution 1:

In Linux, your keyboard will send carriage return if you type Ctrl-M, linefeed when you type Ctrl-J, and backspace when you type Ctrl-H. Can't say with Windows, since you can be typing into so many different kinds of text-input controls, including a console window.

Solution 2:

In Windows, hold Alt and type 013 on the numpad.

Solution 3:

In linux, backspace is Ctrl+H, carriage return is Ctrl+M

If you want to insert a literal carriage return/backspace, you must quote it. Quoting is program-specific, but usually (or at least in bash) Ctrl+V quotes the next character. Other programs have different quoting mechanism, e.g. Ctrl+Q in emacs or Meta+V in nano

Therefore:

  • To insert a carriage return in bash, you would press Ctrl+V then Ctrl+M
  • To insert a backspace in nano you would press Meta+V then Ctrl+H
  • To insert a carriage return in emacs, you would press Ctrl+Q then Ctrl+M

Edit: To insert another control character, look in this table in the first column. For example, to type an escape character you would press ^[ (Ctrl+[)