How to Insert Square Brackets ( [ ] ) on Linux

How to Insert Square Brackets on Linux

by | Oct 30, 2024 | Useful Tech

Looking to insert text into what you have quoted or delete part of it? Dealing with arrays In programming or give n interval in mathematics? Find out here how to insert square brackets ( [ ] ) on Linux using the keyboard, a character map—or just copying and pasting.

First, Ignite( Stages[ 1 ] );

The just about 1,000 lines of code that controlled engine ignition on the Apollo lunar module are, quite poetically, called BURN, BABY, BURN.

The phrase was borrowed from and for Magnificent Montague, it appears, the 1960s DJ that used it to announce the latest hits on the radio. The catchphrase echoed beyond popular culture, computing, and lunar exploration, of course.

In any event, BURN, BABY BURN, like apparently all of Apollo Guidance Computer assembly, gets the job done without using square brackets. Other languages, assembly or higher-level, are full of the edgy braces, of course.

So, let’s produce them:

How to Insert Square Brackets ( [ ] ) on Linux

Using the Keyboard

Time needed: 1 minute

To type square brackets on a Linux keyboard:

  1. Position the text cursor where you want to insert the bracket character.

    Here’s where: You will use square brackets in written text to indicate when you add something to or remove something from a quotation, in mathematical formulas, and with special meaning in programming languages, of course; typically, the opening square bracket is preceded by a whitespace character but followed by text directly and vice versa—like you would parentheses.

  2. Press [ to insert [ and ] to type ].

    Location, location: You will find the [ key to the right of the P key and the ] key right next to it; [ and ] are between P and Enter.
    Keyboard layouts: The keys above work for the US-English keyboard layout; see below for locating the key combination for your layout—if it’s not US-English.
    The left square bracket on a US-English Linux keyboard

Find the Key Combination for Square Brackets

To identify the key or key combination that will let you insert square brackets using your keyboard on Linux:

  1. Open your system settings in either Gnome or KDE.
  2. Go to the Keyboard category.
  3. Gnome: Click the three dots menu for the keyboard layout under Input Sources and select View Keyboard Layout from the menu.
    KDE: Highlight the desired layout on the Layouts tab and click Preview.
    View a keyboard layout in Gnome
  4. Spot the ‘[’ and ‘]’ symbols on the keyboard preview.
    Gnome: Press the Shift, Ctrl, Alt, AltGr and other special keys alone and in combination to reveal how it will alter each key.
    KDE: The lower left portion on the key is the key pressed alone, above it is the key together with Shift; to the lower right is the key together with AltGr or Multi (typically the right Alt key), above that is the key together with Multi and Shift.
    Example: On a German keyboard, [ is AltGr 8.

On a Mac? How to Type Square Brackets ( [ ] ) on a Mac

Using a Character Map

To input square brackets with a character map on Linux:

  1. Open kCharSelect.
    No Characters: Gnome Characters does not include what it deems standard characters—including ‘[’ and ‘]’; you can find extra square bracketing characters with it, of course.
  2. Type square bracket over Enter a search term or character….
  3. Double-click the bracket character you want to copy for inserting.
    Doubly struck and more: The search will also reveal alternative square brackets (such as full-width brackets that are as wide as the letter ‘m’—‘[’—or double-struck brackets for use in mathematics) for copying.
  4. Click To Clipboard.
  5. Paste the bracket where desired.

Insert Square Brackets Using the Linux “Compose” Key

To produce left and right square brackets using the Compose key on Linux:

  1. Set and enable the Compose key for your system.
  2. Position the text cursor where you want to insert the left or right bracket.
  3. Press Compose.
  4. Now type (( (two left parens or two times Shift 9 on a US-English keyboard) for the left square bracket ‘[’.
    Right bracket: Type )) (two right parens or Shift 0 twice) for the right bracket ‘]’.

How to Insert Square Brackets on Linux: FAQ

Can I enter ‘[’ and ‘]’ using Unicode code points?

Yes.

To type square brackets directly using Unicode code points:

  1. Press Ctrl Shift U.
  2. Type the UTF-16 code point for the desired square bracket:
    Left bracket: Type 005B for ‘[’.
    Right bracket: Enter 005D for ‘]’.
    Other brackets: This also works with other UTF-16 code points.
  3. Press Enter.
    Inserting square brackets using Unicode on Linux

Can I also copy square brackets for pasting here?

Yes.

Left square bracket [
Right square bracket ]
Left square bracket upper corner
Left square bracket bar
Left square bracket lower corner
Right square bracket upper corner
Right square bracket bar
Right square bracket lower corner
Top square bracket
Bottom square bracket
Double-struck (mathematical) left square bracket
Double-struck (mathematical) right square bracket

(How to insert square brackets tested with Gnome 47 and KDE 6.2; first published October 2024)

Home » Useful Tech » How to Insert Square Brackets ( [ ] ) on Linux