I want the terminal to highlight the current bash prompt line.
The effect I'm trying to acheive is the same as in text editors where the current line with the cursor is highlighted.
Something like this:
enter image description here

  • 1
    It's conceivable that your shell could support some customization like this, but it's irrelevant to the choice of terminal. Dec 19, 2015 at 13:53
  • This depends on the shell, not on the terminal. Given the appearance of your prompt, I presume you use bash. Please edit your question if this is not the case. Dec 19, 2015 at 22:28
  • oh ok sorry, kinda new to stackexchange and forgot the rules
    Dec 19, 2015 at 22:51

1 Answer 1


If you're happy with highlighting only the prompt, then the following will apply reverse colors on whatever you have already in PS1:


If you have a space at the end of the prompt (this is common practice) that you don't want to highlight:

PS1="[\e[7m]${PS1::-1}[\e(B\e[m] "

Some terminals, at least iTerm for macOS, have the option to set a "cursor guide". This is probably doing exactly what you want to achieve (I have exaggerated the guide in the picture, I usually have it much more transparent, and red, as in the second picture):

iTerm with green transparent cursor guide, running bash

The cursor guide has nothing to do with the shell and will be always be displayed, regardless of what you're doing (very faint red cursor guide on the line reading AC_CONF_AUX_DIR([build]), here shown in the vim editor):

iTerm with faint red cursor guide, running vim

Unfortunately I only run iTerm on macOS, so I don't know if there are terminal emulators out there that can do this for your particular Unix.

  • 1
    PS1="[\e[7m]${PS1::-1}[\e(B\e[m] " Just to get rid of that extra highlighted space at the end.
    – auselen
    Oct 30, 2017 at 9:53
  • @auselen Thanks. Finally got around to add that in.
    – Kusalananda
    Feb 18, 2018 at 8:23

You must log in to answer this question.

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