How to stop cursor from blinking
There is a standard control sequence to turn off cursor blinking on terminals.
printf '\033[?12l'
However many terminals do not implement this setting, so read on.
There is a more widely implemented standard terminal setting for switching cursor visibility between high visibility, normal visibility and invisibility. Some terminals don't make a difference between normal and high, and there's no guarantee that one or the other will or will not blink. In terminfo, emit the cvvis
, cnorm
or civis
string (e.g. tput cvvis
). The corresponding termcap entries are vs
, ve
and vi
.
These setting will not survive a terminal reset, so you may find that it doesn't survive the launching of many full-screen applications. You can overcome this difficulty by adding the cursor configuration changing sequence to your terminal's reset string.
- On a terminfo-based system using ncurses, save your terminal's terminfo settings to a file with
infocmp >>~/etc/terminfo.txt
. Edit the description to change thers1
(basic reset) sequence, e.g. replacers1=\Ec
byrs1=\Ec\E[?12l
. With some programs and settings, you may need to change thers2
(full reset) as well. Then compile the terminfo description withtic ~/etc/terminfo.txt
(this writes under the directory$TERMINFO
, or~/.terminfo
if unset). - On a termcap-based system, grab the termcap settings from your termcap database (typically
/etc/termcap
). Change theis
(basic reset) andrs
(full reset) sequences to append your settings, e.g.:is=\Ec\E[?12l:
. Set theTERMCAP
environment variable to the edited value (beginning and ending with:
).
Some terminals and other applications give you more options:
- The xterm cursor blinks if the
cursorBlink
resource is set totrue
or the-bc
option is passed on the command line. The blink rate is customizable through thecursorOnTime
andcursorOffTime
resources. - Some other GUI terminal emulators can blink the cursor; check their configuration dialog box.
- The Linux PC (VGA) console has a number of cursor settings; their exact meaning and applicability depends on the underlying VGA implementation (Linux framebuffer or video card). If your default cursor blinks, try turning the hardware cursor off and the software cursor on with something like
printf '\033[17;127?c'
(the first parameter 17 gives you the software cursor without a hardware cursor, and the second parameter set to 127 makes it essentially inverse video). See above regarding terminal resets. - In Emacs,
M-x blink-cursor-mode
toggles the cursor's blinking. Put(blink-cursor-mode 0)
in your~/.emacs
to turn it off. This is a global setting and does not apply in a text terminal.
See also Juri Linkov (Jurta)'s No Blinking page for how to turn off blinking in Lesstif, Tk, Gtk (Gnome), Qt (KDE), Firefox, and more.
This gives you a solid yellow block (nonblinking) as a cursor:
echo -n -e '\e[?17;14;224c'
For more info check these references: Linuxgazette and EmacsWiki as well as the file /usr/src/linux/Documentation/VGA-softcursor.txt
(if present on your system)
I found this to be easier if you have root permissions:
~$ echo 0 > /sys/class/graphics/fbcon/cursor_blink
I put it in the machine startup script like /etc/rc.local
for arch linux.