Producing a specific ASCII character in Ubuntu

If you are using Gnome (stock Ubuntu does) you can do that by holding down both the Ctrl and Shift keys and typing u followed by the hexadecimal value of the character.

To produce the backslash \, you would hold Ctrl + Shift and press U, 5 and C.

On Windows you type the decimal value while on Linux you type the hexadecimal value (which is usually shorter if you go in the higher numbers). The u stands for Unicode.

A pretty complete table of hexadecimal values can be found here. Warning, page can take a long time to load!

Linux's console driver doesn't have a facility for entering characters this way... but it isn't really needed since shells can handle this themselves.

$ echo $'\x5c'

Another option (but it does not insert a character by ASCII/Unicode code) is to activate the ComposeKey (like right Alt in my case), so that you can then type things like:

  • Alt + = + e → €
  • Alt + ' + e → é
  • Alt + ^ + e → ê

etc. In case you want to enter frequently used latin letters (as in Spanish, French, etc), this might be faster than having to learn the Unicode code points. It's all about having choice!