I know I can change some fundamental settings of the Linux console, things like fonts, for instance, with dpkg-reconfigure console-setup.

But I'd like to change things like blinkrate, color, and shape (I want my cursor to be a block, at all times). I've seen people accomplishing this. I just never had a chance to ask those people how to do that.

I don't mean terminal emulator windows, I mean the Linux text console, you reach with Ctrl+Alt+F-key

I'm using Linux Mint at the moment, which is a Debian derivate. I'd like to know how to do that in Fedora as well, though.

Edit: I might be on to something

I learned from this website, how to do the changes I need. But I'm not finished yet.

I've settled on using echo -e "\e[?16;0;200c" for now, but I've got a problem: when running applications like vim or irssi, or attaching a screen session, the cursor reverts back to being a blinking gray underscore.

And of course, it only works on this one tty all other text consoles are unaffected.

So how can I make those changes permanent? How can I populate them to other consoles?

  • 1
    You might want to check out setterm(1) and set(1P).
    – user13742
    Commented Nov 11, 2012 at 20:35
  • @htor and how exactly? I use setterm to turn off the console beep, but how should I set cursor shapes? In fact, setterm was the first place I looked before finding the escape sequence.
    – polemon
    Commented Nov 11, 2012 at 20:41
  • I just wanted a quick way to restore a wacked terminal. @user13742's comment worked for me: setterm -cursor on
    – qneill
    Commented Dec 23, 2015 at 21:53

5 Answers 5


GitHub Gist: How to change cursor shape, color, and blinkrate of Linux Console

I define the following cursor formatting settings in my .bashrc file (or /etc/bashrc):

# pretty prompt and font colors

# alter the default colors to make them a bit prettier
echo -en "\e]P0000000" #black
echo -en "\e]P1D75F5F" #darkred
echo -en "\e]P287AF5F" #darkgreen
echo -en "\e]P3D7AF87" #brown
echo -en "\e]P48787AF" #darkblue
echo -en "\e]P5BD53A5" #darkmagenta
echo -en "\e]P65FAFAF" #darkcyan
echo -en "\e]P7E5E5E5" #lightgrey
echo -en "\e]P82B2B2B" #darkgrey
echo -en "\e]P9E33636" #red
echo -en "\e]PA98E34D" #green
echo -en "\e]PBFFD75F" #yellow
echo -en "\e]PC7373C9" #blue
echo -en "\e]PDD633B2" #magenta
echo -en "\e]PE44C9C9" #cyan
echo -en "\e]PFFFFFFF" #white
clear #for background artifacting

# set the default text color. this only works in tty (eg $TERM == "linux"), not pts (eg $TERM == "xterm")
setterm -background black -foreground green -store

# http://linuxgazette.net/137/anonymous.html
cursor_style_default=0 # hardware cursor (blinking)
cursor_style_invisible=1 # hardware cursor (blinking)
cursor_style_underscore=2 # hardware cursor (blinking)
cursor_style_lower_third=3 # hardware cursor (blinking)
cursor_style_lower_half=4 # hardware cursor (blinking)
cursor_style_two_thirds=5 # hardware cursor (blinking)
cursor_style_full_block_blinking=6 # hardware cursor (blinking)
cursor_style_full_block=16 # software cursor (non-blinking)

cursor_background_black=0 # same color 0-15 and 128-infinity
cursor_background_blue=16 # same color 16-31
cursor_background_green=32 # same color 32-47
cursor_background_cyan=48 # same color 48-63
cursor_background_red=64 # same color 64-79
cursor_background_magenta=80 # same color 80-95
cursor_background_yellow=96 # same color 96-111
cursor_background_white=112 # same color 112-127

cursor_foreground_default=0 # same color as the other terminal text

cursor_styles="\e[?${cursor_style_full_block};${cursor_foreground_black};${cursor_background_green};c" # only seems to work in tty

# http://www.bashguru.com/2010/01/shell-colors-colorizing-shell-scripts.html


prompt_chars_underlined=4 # doesn't seem to work in tty
prompt_chars_blinking=5 # doesn't seem to work in tty


start_prompt_styles="\e[${prompt_chars_bold}m" # just use default background and foreground colors

PS1="${start_prompt_styles}[\u@\h \W] \$${end_prompt_styles}${cursor_styles} "

# end pretty prompt and font colors
  • 4
    +1 for literally having me waiting years before someone comes up with that. Thanks man!
    – polemon
    Commented Nov 8, 2015 at 16:08
  • 3
    In my case blue was 32, green was 64 and red was 128. To get the other colors, you simply add them up. For example, cyan = blue + green. Hence, to get cyan, 32 + 64 = 96, hence, you need to write 96. White = red + green + blue. Hence, in my case, white is 32 + 64 + 128 = 224.
    – Utku
    Commented Sep 25, 2016 at 10:57
  • -bash: setterm: command not found error on macOS Mojave 10.14.2?
    – Dut A.
    Commented Jul 9, 2019 at 15:51
  • @DutA. right above setterm it says: this only works in tty (eg $TERM == "linux"), not pts (eg $TERM == "xterm"). If you're on MacOS, your terminal is probably xterm-256color but you can check the aforementioned environment variable if you'd like to.
    – Sinjai
    Commented Jan 18, 2021 at 10:02

Most apps use the cnorm capability to set the cursor back to the "normal" state. By default this is the blinking underline. But you can override this in your terminfo. This should fix most applications (vim, tmux, etc.). Issue this command:

infocmp linux | sed 's/cnorm=[^,]*/cnorm=\\E[?25h\\E[?48;0;32c/' | tic -

This should create ~/.terminfo/l/linux which should be picked up by most of the terminal apps next time they run.

  • This is fantastic! It took far too long to find this, and my search failure has re-invigorated my desire to convince the world to stop mis-using the words "console" and "terminal". 99.99% of the articles claiming to discuss change the cursor in a console are just talking about changing the cursor in a gnome terminal or similar. Quick suggestion: rather than creating a temporary file and fixing it with 'patch', it would be cleaner to do infocmp ... | sed ... > linux. Using patch is a good visual, but the sed implementation makes for easy cut-n-paste. Commented Mar 7 at 13:14
  • Hah, yeah, I remember spending days on this until I figured this one out. :) I've added a one liner based on your recommendation, thanks for the idea! Please verify!
    – ypsu
    Commented Mar 8 at 19:50

If you use bash, you can use PROMPT_COMMAND which will execute a command after each command. Put the following in your .bashrc

PROMPT_COMMAND='echo -e "\e[?16;0;200c"'
  • I was almost settling on something like that, but I'm quite sure I can accomplish what I want with something like a kernel option or whatever.
    – polemon
    Commented Nov 13, 2012 at 8:08
  • 1
    Or put PROMPT_COMMAND='echo -e "\033[?16;0;224c"' if you want a non blinking solid white block, instead of an orange block.
    – Utku
    Commented Sep 25, 2016 at 10:46

I added the following two parameters to my kernel command line in grub; this gives me a permanent full block blinking green cursor:

vt.cur_default=6 vt.color=2

The standard, unmodified colors for vt.color you can pick from are (see the setvtrgb command to change them):

| Normal | Bright | Color   |
|      0 |      8 | Black   |  
|      1 |      9 | Red     |  
|      2 |     10 | Green   |
|      3 |     11 | Yellow  |
|      4 |     12 | Blue    |
|      5 |     13 | Magenta |
|      6 |     14 | Cyan    |
|      7 |     15 | White   |  

Assuming you use GNU/Linux and have root access, you can modify cursor in tty mode by modifying /sys/module/vt/parameters/cur_default file. By doing

echo 0 > /sys/module/vt/parameters/cur_default

will set "block cursor".

You may want to change the values, from 0-7, to get other shapes. (I've tested it on Mint 19.3, Ubuntu 16.04 and a few other Debian distros, it works in tty (as you asked) but on few occasions it did not work. I found the above by accident. I tried setterm suggeseted by @user13742 and it works for me. I suspect setterm achieves that by modifying the files in /sys/module/vt/parameter.)

source: Show current "setterm" values/settings


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .