Use key combinations to output special characters in Linux

Takeaway: With key combinations, you won’t be limited by the keyboard.

The number of words in this article: 2787, the reading time is about 3 minutes

A typical keyboard has only about 100 keys.

Many keys have two characters (also called glyphs) thanks to the Shift key. Glyphs are commonly used to type letters with accents and diacritics, to generate mathematical formulas or symbols in currency, or to add fun emoji. In some regions, some keys even have three glyphs.

However, there are some glyphs that won’t appear on your keyboard no matter where you are. Fortunately, Linux provides the use of Compose Key to get these glyphs.

There is no key combination on your keyboard, at least not by default, but you can set a key you don’t use as a key combination. I use the Alt key next to the space bar on the computer and the menu key on the tablet as a key combination.

Download Linux Key Combination Cheat Sheet 🔗 opensource.com

Setting up key combinations in GNOME

A screenshot shows the keyboard and mouse options visible. The “Compose Key” option is set to Right Alt.

On the GNOME desktop, install the Tweaks application from the Repository. You can also install from the terminal ( apt command for Debian based distributions, dnf for Fedora):


  1. $ sudo dnf install gnome-tweaks

After launching the optimization app:

1. Click the Keyboard & Mouse category in the left column

2. Find the Compose key setting and assign a key

3. Close the optimized application

Setting key combinations on the KDE Plasma desktop

A screenshot shows the advanced options threaded under Keyboard settings. “Configure keyboard options” is checked, “Position of Compose Key” is checked within that menu, and “Right Alt” is checked within that menu.

On the KDE Plasma desktop, open System Settings and find the Input Devices control interface. Then:

1. On the Input Devices screen, click the Advanced tab

2. Find the Compose key list item and specify a key

3. Click the “Apply” button in the lower right corner, then close the System Settings

Use Combination Sequences

To enter hidden characters, you need to press and release the key combination. This will allow you to enter combo mode. In combination mode, you press and release a key, and then press a key to combine characters.

E.g:

1. Press the key combination and release, you will enter the combination mode

2. Press the single quote ( ' ) and release

3. Press E and release, it’s a valid combination, so it’s now out of combination mode

You entered a character: É !

Some combination sequences require only two key combinations, while others require three keys and at least one special character to be pressed four times.

diacritical characters

It’s a niche world, so there’s a good chance your friend’s name uses a glyph that isn’t native to your keyboard. You can now skip diacritics and enter names with appropriate modifiers.

The following are examples of combined sequences of common diacritics:

' + <字母> = á é í ó ú ć ń ý j́́ ẃ ź

` + <字母> = à è ì ò ù ǹ ỳ ẁ

~ + <字母> = ã ẽ ĩ õ ũ ñ ỹ

^ + <字母> = â ê î ô û ĉ ŷ ĵ ŵ ẑ

u + <字母> = ă ĕ ĭ ŏ ŭ

c + c = č

- + <字母> = ā ē ī ō ū đ

, + <字母> = ą ę į ǫ ų ç ḑ ţ

Only a few common ones are listed here, not all combinations.

currency symbol

International banking is also made easy thanks to composite keys:

- + Y = ¥

- + L = £

= + E =

= + L =

= + N =

= + R =

= + W =

/ + m =

R + s =

C + r =

F + r =

Again, this is not a complete list, but a good start.

funny font

Diacritics and currency symbols have utility, but key combinations can also be used for entertainment:

< + 3 =

< + > =

# + q =

: + ) =

: + ( =

p + o + o = 💩

longevity and prosperity

My favorite “secret” glyph in Linux is the traditional Vulcan call for “longevity and prosperity”.

L + L + A + P = 🖖

find all glyphs

More glyphs are available through key combinations, and you can discover new glyphs by pressing random combination sequences. A more organized way to find glyphs is to refer to the Compose file located in /usr/share/X11/locale/en_US.UTF-8 (the absolute path will need to be adjusted according to the locale your keyboard is using).

This file is crashing because it contains over 6000 lines of combined sequences, many of which are complex combinations of ASCII and Unicode. For quick and easy reference to common and basic sequences, you can download our key combination cheat sheet
🔗 opensource.com
. It offers sequences covering math, typography, music, arrows, diacritics, currency, and more.

Now that you know the secret, you can express more.

The text and pictures in this article are from Linux China

loading.gif

This article is reprinted from https://www.techug.com/post/using-key-combinations-to-output-special-characters-in-linux26f523fb5f4e34e7ff0e/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment

Your email address will not be published.