How to type special characters in Linux?
In windows there is possibility to type from keyboard special signs by holding alt key and typing a few numbers, that depends on with sign you want to use. Does it work with linux in the same way?
frabra, not all applications support unicode input such way. But rather often starting number with zero helps, i. e. type Alt + 08212 for M-dash, instead of Alt + 8212.
@Smylic that won’t work for most applications because the decimal Alt-code will be modulo 256. You have to use hex numpad
Does this answer your question? How do you type Unicode characters using hexadecimal codes? (While most of the answers are about Windows, a couple are about Linux.)
7 Answers 7
You can use Ctrl + Shift + u followed by the code in hex. (You only need to hold down Ctrl and Shift while typing the code)
john, do you know what supplies this functionality? i haven’t heard of it before. where does it work, on the console? Ubuntu’s defaults in GNOME? thx.
found a similar source (minus the u , just hold down Ctrl+Shift ) for «works in GNOME», and a method for VIM that uses the u but not the Shift .
Thx, works for me. In Ubuntu’s terminal (under X), I’m able to type Ctrl+Shift+U, let up all 3, and then type 66 followed by Space and I end up with «f» which is the correct character for 66 in UTF-8. It didn’t work from tty1 (control-alt-F1 — non-graphical terminal) though.
I use Compose (mapped as Right-Ctrl), which should work in all DEs since it is provided by X. Compose » A => ä , Compose g p i => «π», etc
X uses something called the compose key. By pressing Compose , some key , some key … in sequence, you can input characters. I have my compose key set to Menu ; to type a © (copyright symbol), I would use Menu , o , c .
A full list of X compose key combinations can be found online (200 KiB), or locally in /usr/share/X11/locale/en_US.UTF-8/Compose .
In Gnome, the compose key can be set by going to Preferences → Keyboard → Layouts tab → Layout Options → Compose key position.
How does the «memorize unicode code points» answer have twice as many upvotes as the compose key? Insanity.
Perfect. Without GNOME, the compose key can be set through setxkbmap . For example, $ setxkbmap -option ‘compose:menu’ will set the «menu» key (between Alt Gr and right Ctrl on my keyboard) as the compose key.
@mehaase Because, on my laptop, there is no available key for me to map as Compose. So I’ll take an imperfect answer over the elegant one.
Cliff, what strange laptop is that? I have a tiny laptop which has a «menu» key (which virtuallinux uses as Compose key, as do I). It doesn’t have a free unused key? No «Windows» key you don’t need in Linux anyway? Weird.
@Cliff, I managed to set it to “3rd level of Left Ctrl”, so spare key required; I hope you can find something that works for you.
Inputting Unicode characters in Linux varies. The UTF-8 and Unicode FAQ has a section containing different input methods:
- Ctrl + Shift + U [unicode in hex] is defined in ISO 14755 and implemented by GTK2+, and works in GNOME-Terminal and other applications.
- Ctrl + V u [unicode in hex] works in VIM.
- Alt + [unicode in decimal using numpad digits] works at the console providing your environment is properly configured to expect UTF-8 (via LOCALE or LANG environment variables). (unicode_start manpage).
Other methods you could use:
- Cut-n-paste characters from a small input file containing the characters you want.
- Use xmodmap to remap keys in X (see the FAQ link above for examples).
(I removed the UTF8 tag you added to the question, as that is actually an encoding, which is not used when typing a character.)
I can confirm that alt-numpad works for me in ubuntu 12.04’s tty1 console (control-alt-F1) with $LANG=en_US.utf8 The codes are decimal, not hex though, so instead of 66 (hex) for «f», I hold Alt, type 102, let Alt up and out pops «f».
The Linux console also supports compose keys (The compose key is often Alt + AltGr or PrintScrn ) — see How to define a Compose Key in terminal on the Unix and Linux Stack Exchange for details.
Alternative way: Use Ctrl + Shift + u followed by the code in hex and Enter .
Unlike the accepted answer tells, do not hold down Ctrl and Shift while typing the code. Otherwise it may not work because it may conflict with some shortcut key of the application you are using, e.g. Ctrl + Shift + c in your terminal emulator. That may be a bug though.
This way works at least with xfce4-terminal, gnome-terminal, lxterminal, libreoffice, mousepad, chromium-browser and firefox.
Upvoted. Though I found that this works on Xubuntu in the Terminal Emulator, but not in editors — nevertheless, one can always type it in the terminal using this method, then copy-paste. Acceptable if you don’t use extra-special characters all the time.
On most systems I need to hold ctrl+shift like in the accepted answer, but there are some on which your answer is right. Maybe it depends on the X input method? I think you should merge your answers into one, especially when you find out when to use which answer.
There’s a better method for both Linux and Windows than using alt-key codes that doesn’t require you to remember any codes. It’s described in detail here.
The gist is that you use AutoHotKey (Windows) or AutoKey (Linux). Both run in the background and accept arbitrary strings as trigger to run a command, which in this case is to send a special character to the clipboard and then paste it to whatever program is currently being used.
The example given has /delta as the trigger (including the forward slash). After typing those six characters, they are deleted and replaced with a δ.
If you are a US key user and need to type special characters infrequently, I recommend switching your keyboard layout to the «us(altgr-intl)» variation— that’s XKB notation. Your keyboard will work normally unless you hold the right Alt key, also known «AltGr», then you will mostly be able to access the extra characters shown in blue here:
I say «mostly» because that’s a screenshot of the main US International layout. I found the details of the «altgr-intl» variation defined in this file on Arch Linux: /usr/share/X11/xkb/symbols/us : Here are the differences defined there:
// five dead keys moved into level3: ┊key < [ grave, asciitilde, dead_grave, dead_tilde ] >; ┊key < [apostrophe,quotedbl, dead_acute, dead_diaeresis ] >; // diversions from the MS Intl keyboard: ┊key < [ 1, exclam, onesuperior, exclamdown ] >; ┊key < [ r, R, ediaeresis, Ediaeresis ] >; ┊key < [ j, J, idiaeresis, Idiaeresis ] >; ┊key < [ x, X, oe, OE ] >; ┊key < [ v, V, registered, registered ] >; // onequarter etc (not in iso8859-15) moved to get three unshifted deadkeys: ┊key < [ 6, asciicircum, dead_circumflex, onequarter ] >; ┊key < [ 7, ampersand, dead_horn, onehalf ] >; ┊key < [ 8, asterisk, dead_ogonek, threequarters ] >;
This alternate layout doesn’t have the additional «dead keys» that the main International layout does.
The four columns in each array are Regular, Shifted, AltGr, AltGr Shifted.
So for example to type ¡ I press «».
You can search for an image of the US International layout until you remember the locations of the symbols you need.
Enter special characters
You can enter and view thousands of characters from most of the world’s writing systems, even those not found on your keyboard. This page lists some different ways you can enter special characters.
Methods to enter characters
Characters
The character map application allows you to find and insert unusual characters, including emoji, by browsing character categories or searching for keywords.
You can launch Characters from the Activities overview.
Emoji
Insert emoji
- Press Ctrl + ; .
- Browse the categories at the bottom of the dialog or start typing a description in the search field.
- Select an emoji to insert.
Compose key
A compose key is a special key that allows you to press multiple keys in a row to get a special character. For example, to type the accented letter é , you can press compose then ‘ then e .
Keyboards don’t have specific compose keys. Instead, you can define one of the existing keys on your keyboard as a compose key.
Define a compose key
- Open the Activities overview and start typing Settings .
- Click on Settings .
- Click Keyboard in the sidebar to open the panel.
- In the Type Special Characters section, click Compose Key .
- Turn the switch on for the Compose Key .
- Tick the checkbox of the key that you want to set as the Compose key.
- Close the dialog.
You can type many common characters using the compose key, for example:
- Press compose then ‘ then a letter to place an acute accent over that letter, such as é .
- Press compose then ` (back tick) then a letter to place a grave accent over that letter, such as è .
- Press compose then » then a letter to place an umlaut over that letter, such as ë .
- Press compose then — then a letter to place a macron over that letter, such as ē .
For more compose key sequences, see the compose key page on Wikipedia .
Code points
You can enter any Unicode character using only your keyboard with the numeric code point of the character. Every character is identified by a four-character code point. To find the code point for a character, look it up in the Characters application. The code point is the four characters after U+ .
To enter a character by its code point, press Ctrl + Shift + U , then type the four-character code and press Space or Enter . If you often use characters that you can’t easily access with other methods, you might find it useful to memorize the code point for those characters so you can enter them quickly.
Keyboard layouts
You can make your keyboard behave like the keyboard for another language, regardless of the letters printed on the keys. You can even easily switch between different keyboard layouts using an icon in the top bar. To learn how, see Use alternative keyboard layouts .
Input methods
An Input Method expands the previous methods by allowing to enter characters not only with keyboard but also any input devices. For instance you could enter characters with a mouse using a gesture method, or enter Japanese characters using a Latin keyboard.
To choose an input method, right-click over a text widget, and in the menu Input Method , choose an input method you want to use. There is no default input method provided, so refer to the input methods documentation to see how to use them.