How to Type Special Characters on Linux: Compose Key and Unicode Input
- ○ 1. How to Type Special Characters on Mac: The Complete Guide
- ○ 2. How to Type Special Characters on Windows: Alt Codes and Beyond
- ● 3. How to Type Special Characters on Linux: Compose Key and Unicode Input
- ○ 4. Input Method Editors (IME): How CJK Text Input Works
- ○ 5. Dead Keys: How to Type Accented Characters Without a Special Keyboard
- ○ 6. Unicode Hex Input on macOS: Type Any Character by Code Point
- ○ 7. Windows Alt Codes: Complete Reference for Special Characters
Linux offers some of the most flexible special character input methods of any desktop operating system. The Compose key system — inherited from MIT's X Window System in the 1980s — lets you type hundreds of characters through memorable multi-key sequences. Combined with the built-in Unicode hex input method, you can reach every Unicode character without memorizing arbitrary numeric codes.
Method 1: The Compose Key
The Compose key is the cornerstone of special character input on Linux. When you press the Compose key followed by a sequence of keys, the system produces a single special character. The sequences are designed to be intuitive.
Setting Up the Compose Key
The Compose key isn't a physical key — you assign it to an existing key you rarely use. Common choices:
- Right Alt — most convenient, won't conflict with left Alt shortcuts
- Caps Lock — excellent choice if you rarely use Caps Lock
- Right Ctrl — good if right Ctrl is otherwise unused
- Menu key — the key between right Alt and right Ctrl on many keyboards
- Scroll Lock — rarely used, out of the way
On GNOME (Ubuntu, Fedora, etc.)
- Open Settings > Keyboard
- Scroll to Special Character Entry
- Click Compose Key
- Toggle on and select your key from the dropdown
Alternatively, use GNOME Tweaks:
1. Install GNOME Tweaks: sudo apt install gnome-tweaks (Ubuntu) or via your package manager
2. Open Tweaks > Keyboard & Mouse
3. Find Compose Key and select from the dropdown
On KDE Plasma
- System Settings > Input Devices > Keyboard
- Click the Advanced tab
- Expand Position of Compose key
- Check your preferred key
Command Line (works on any desktop)
# Set Compose key via gsettings (GNOME)
gsettings set org.gnome.desktop.input-sources xkb-options "['compose:ralt']"
# Options: compose:ralt, compose:caps, compose:rctrl, compose:menu, compose:lwin
For immediate effect in X11 without relogging:
setxkbmap -option compose:ralt
Using the Compose Key
Press Compose, release it, then type the sequence. The sequences are designed to be logical:
Currency and common symbols:
| Sequence | Character | Mnemonic |
|---|---|---|
| Compose, -, - | — | two dashes = em dash |
| Compose, -, . | – | shorter = en dash |
| Compose, ., . | … | three dots = ellipsis |
| Compose, o, c | © | o + c = copyright |
| Compose, o, r | ® | o + r = registered |
| Compose, t, m | ™ | t + m = trademark |
| Compose, =, e | € | = + e = euro |
| Compose, =, L | £ | = + L = pound |
| Compose, =, Y | ¥ | = + Y = yen |
| Compose, +, - | ± | plus + minus = plus-minus |
| Compose, !, ! | ¡ | inverted exclamation |
| Compose, ?, ? | ¿ | inverted question |
| Compose, <, < | « | two < = left guillemet |
| Compose, >, > | » | two > = right guillemet |
| Compose, s, s | ß | German sharp s |
| Compose, a, e | æ | a + e ligature |
| Compose, o, e | œ | o + e ligature |
| Compose, /, o | ø | slash + o = o-slash |
| Compose, ^, ^ | ^ | (just an example) |
| Compose, 1, 2 | ½ | one half |
| Compose, 1, 3 | ⅓ | one third |
| Compose, 3, 4 | ¾ | three quarters |
Accented characters:
| Sequence | Character |
|---|---|
| Compose, ', e | é |
| Compose, ', a | á |
| Compose, `, e | è |
| Compose, `, a | à |
| Compose, ^, e | ê |
| Compose, ^, a | â |
| Compose, ~, n | ñ |
| Compose, :, u | ü |
| Compose, :, o | ö |
| Compose, :, a | ä |
| Compose, ,, c | ç |
The full list of default sequences is in /usr/share/X11/locale/en_US.UTF-8/Compose — it's thousands of entries long.
Method 2: Ctrl+Shift+U Unicode Hex Input
GTK applications (most GNOME apps) support a built-in Unicode input method. No setup required — it works everywhere GTK is used.
How It Works
- While in a text field, press Ctrl+Shift+U
- An underlined u appears (or a small entry box, depending on the app)
- Type the hex code point of the character you want
- Press Enter or Space to confirm
Examples
| Code | Character | Name |
|---|---|---|
| 2014 | — | Em dash |
| 2013 | – | En dash |
| 00B0 | ° | Degree sign |
| 03C0 | π | Pi |
| 2665 | ♥ | Heart |
| 2605 | ★ | Star |
| 00E9 | é | e-acute |
| 00F1 | ñ | n-tilde |
| 221E | ∞ | Infinity |
| 2260 | ≠ | Not equal |
| 1F600 | 😀 | Grinning face (emoji) |
Note that unlike macOS Unicode Hex Input, Ctrl+Shift+U in GTK apps supports code points beyond U+FFFF — you can type emoji code points directly.
Find the code point for any character with our Unicode Lookup tool.
Terminal Usage
In GNOME Terminal, the method is slightly different: - Press Ctrl+Shift+U - Type the hex digits - Press Enter
In terminals running other shells, you may be able to use the shell's own Unicode escape:
# In zsh or bash (type this, then Enter)
echo $'\u00E9' # é
echo $'\u2014' # —
echo $'\U1F600' # 😀 (capital U for code points above U+FFFF)
Method 3: GNOME Characters App
GNOME includes a dedicated character browser application similar to macOS's Character Viewer.
Opening GNOME Characters
- Search "Characters" in the Activities overview (Super key)
- Or run
gnome-charactersfrom a terminal
Features
The app lets you browse Unicode by category: - Letters (Latin, Greek, Cyrillic, Arabic, etc.) - Punctuation - Numbers - Math symbols - Symbols (currency, arrows, dingbats) - Emoji
Click any character to see its Unicode name, code point, and a large preview. Click Copy to copy it to the clipboard, or double-click to add it to the Recent list.
The search bar understands character names: "em dash," "copyright," "infinity," "snowman."
Adding to Favorites
Click the heart icon on any character to add it to Favorites. Favorites appear in their own category for fast access.
KDE Equivalent
KDE users have KCharSelect (search "KCharSelect" or run kcharselect). It offers similar browsing with a font selector, so you can find characters in your chosen typeface.
Method 4: IBus and Fcitx Input Methods
For extensive multilingual input — especially CJK languages — Linux uses Input Bus (IBus) or Fcitx as input method frameworks. But these also offer useful special character input for everyone.
IBus
IBus is the default input method framework on GNOME-based distributions.
Checking if IBus is running:
ibus list-engine
Useful IBus engines for special characters:
- ibus-typing-booster — predictive input with Unicode character completion
- ibus-unikey — Vietnamese input
- ibus-m17n — massive multilingual engine supporting dozens of scripts
Starting IBus daemon if not running:
ibus-daemon -drx
Fcitx5
Fcitx5 is the modern replacement for Fcitx4 and is preferred on KDE Plasma and some other desktops.
Installing on Ubuntu:
sudo apt install fcitx5 fcitx5-chinese-addons
Configure via:
fcitx5-configtool
Both IBus and Fcitx provide a system tray indicator. Click it to switch input methods or access preferences.
Method 5: Custom .XCompose Files
The Compose key's sequence table is entirely customizable via the ~/.XCompose file. You can add new sequences, override defaults, or import existing sets.
Creating a Custom .XCompose File
Create or edit ~/.XCompose:
# Import system defaults first
include "%L"
# Custom sequences
<Multi_key> <a> <r> : "→" U2192 # arrow right
<Multi_key> <l> <a> : "←" U2190 # arrow left
<Multi_key> <u> <a> : "↑" U2191 # arrow up
<Multi_key> <d> <a> : "↓" U2193 # arrow down
# Math
<Multi_key> <i> <n> <f> : "∞" U221E # infinity
<Multi_key> <t> <h> <e> <t> <a> : "θ" U03B8 # theta
<Multi_key> <p> <i> : "π" U03C0 # pi
<Multi_key> <s> <i> <g> <m> <a> : "σ" U03C3 # sigma
# Typographic
<Multi_key> <h> <r> : "─" U2500 # horizontal rule
<Multi_key> <e> <l> <l> : "…" U2026 # ellipsis
# Emoji (works in some configurations)
<Multi_key> <colon> <parenright> : "🙂" # :)
The include "%L" line imports the locale's default Compose file, so you keep all the built-in sequences and only add your own.
Format Reference
Each line has the form:
<Multi_key> <key1> <key2> ... : "character" [U+codepoint] [# comment]
Key names come from X11 keysym names. Common ones:
- <space>, <Return>, <Tab>
- <period>, <comma>, <minus>, <plus>, <equal>
- <apostrophe>, <grave>, <asciicircum>, <asciitilde>, <colon>
- Letters: <a> through <z>, <A> through <Z>
Applying Changes
Changes to .XCompose take effect when you restart your X session (log out and back in) or restart the IBus/Fcitx daemon:
ibus restart
# or
pkill fcitx5 && fcitx5 &
Method 6: Terminal and Shell Techniques
For command-line users and developers, several shell methods insert Unicode characters directly.
Bash/Zsh ANSI-C Quoting
# In bash and zsh, $'...' interprets escape sequences
echo $'\u00E9' # é (BMP characters)
echo $'\U0001F600' # 😀 (supplementary characters, note capital U)
# Use in variables
COPYRIGHT=$'\u00A9'
echo "Copyright $COPYRIGHT 2025"
Inserting in Readline (bash prompt)
While typing at the bash prompt, press Ctrl+V followed by a Unicode input method. In some terminals, Ctrl+V then Ctrl+ followed by a Unicode character code works, but results vary by terminal emulator.
More reliably, paste from clipboard after using Ctrl+Shift+U in the terminal (GNOME Terminal).
In Vim
In insert mode:
- Ctrl+V then u followed by a four-digit hex code: inserts BMP characters
- Ctrl+V then U followed by an eight-digit hex code: inserts any Unicode character
For example: In insert mode, press Ctrl+V, then u, then 2014 → inserts —
Choosing the Right Method
| Situation | Best Method |
|---|---|
| Common typographic characters | Compose key |
| Known Unicode code point | Ctrl+Shift+U |
| Browsing characters visually | GNOME Characters / KCharSelect |
| CJK or complex script input | IBus/Fcitx with appropriate engine |
| Custom memorable sequences | ~/.XCompose |
| Terminal/scripting | $'\u...' in bash/zsh |
| Vim editing | Ctrl+V u{code} |
Troubleshooting
Compose key not working after setting it up:
- Log out and back in for the change to fully take effect
- Try setxkbmap -option compose:ralt in a terminal to apply immediately in X11
- On Wayland, Compose key configuration may work differently — check your compositor's keyboard settings
Ctrl+Shift+U not working: - This method requires GTK input method support. It works in GNOME apps but not in terminal emulators by default (GNOME Terminal is an exception) - In Firefox, the method is disabled by default; use the clipboard from GNOME Characters instead
Wrong character from Compose sequence:
- Check your locale: echo $LANG. The Compose file loaded depends on your locale setting
- View the actual sequences being used: cat /usr/share/X11/locale/$(locale | grep LC_CTYPE | cut -d= -f2 | tr -d '"')/Compose | grep "your sequence"
IBus swallowing Compose key: - If IBus is running and intercepts your Compose key before X11 handles it, try configuring Compose within IBus settings, or disable IBus for the specific input context
Next in Series: If you work with CJK text, you need to understand how Input Method Editors work at a deeper level. See Input Method Editors (IME): How CJK Text Input Works for a full explanation.