Terminal & CLI

How do I change cursor shape in terminal?

→  Send an ANSI escape sequence: \e[N q where N = 1-6 for different shapes (1=blinking block, 2=steady block, 3=blinking underline, etc.).

Answer

How do I change cursor shape in terminal?

Send an ANSI escape sequence: \e[N q where N = 1-6 for different shapes (1=blinking block, 2=steady block, 3=blinking underline, etc.).

These escape codes work in most modern terminals. For example, 'echo -e "\e[5 q"' sets a blinking bar cursor. The codes are based on the DECSCUSR (DEC Set Cursor Style) specification.

Q

A

← All FAQs