How to change the Terminal cursor from box to line?

At the time the question was asked (October 2011), the way to do this with the given terminal was via its preferences dialog. After a few years (November 2014), someone added support for the DECSUSR escape sequence which was used (and extended) in xterm since December 2009.

The change mentions these choices:

+        VTE_CURSOR_STYLE_TERMINAL_DEFAULT = 0,
+        VTE_CURSOR_STYLE_BLINK_BLOCK      = 1,
+        VTE_CURSOR_STYLE_STEADY_BLOCK     = 2,
+        VTE_CURSOR_STYLE_BLINK_UNDERLINE  = 3,
+        VTE_CURSOR_STYLE_STEADY_UNDERLINE = 4,
+        /* *_IBEAM are xterm extensions */
+        VTE_CURSOR_STYLE_BLINK_IBEAM      = 5,
+        VTE_CURSOR_STYLE_STEADY_IBEAM     = 6
+} VteCursorStyle;

The feature is documented in XTerm Control Sequences:

CSI Ps SP q
          Set cursor style (DECSCUSR, VT520).
            Ps = 0  -> blinking block.
            Ps = 1  -> blinking block (default).
            Ps = 2  -> steady block.
            Ps = 3  -> blinking underline.
            Ps = 4  -> steady underline.
            Ps = 5  -> blinking bar (xterm).
            Ps = 6  -> steady bar (xterm).

so that you could (for example) do this on the command-line to change the cursor to a bar ("I-beam"):

printf '\033[6 q'

(the space is needed, corresponds to "SP" in the documentation).


This is a function of the Terminal program itself.

In Ubuntu, if you're using terminal you can change this in the terminal application preferences, which is accessible from the terminal application menu in the Ubuntu status bar in the top left of the screen.

Terminal Menu
  -> Preferences
    -> Profile
      -> Cursor
        -> Cursor Shape
          -> I-beam

There's a pull-down menu for "Cursor Shape" and "I beam" is an option.

Tags:

Linux

Terminal