Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to make commands I've typed (input) into terminal stand out from all the output.

For example:

imac:~ buster$ chmod -R g-w myfolder
imac:~ buster$ cd myfolder
imac:myfolder buster$ ls -l
total 0
drwxr-xr-x 9 root admin 306 Apr 20 2010 bin
drwxr-xr-x 7 root admin 238 Apr 20 2010 include
drwxr-xr-x 73 root admin 2482 May 18 17:16 lib
drwxr-xr-x 6 root admin 204 Apr 20 2010 man
imac:myfolder buster$ echo Go Giants!
Go Giants!

bold jumps to mind but I'd accept a color or even highlighting the whole line...

I'm sure there's a way to do this but it's not obvious to me...


share|improve this question
up vote 7 down vote accepted

Edit your ~/.bash_profile or ~/.bashrc (see Gilles' comment below) and add the following lines:

PS1="${OFF}\u@\h:\w \$${BOLD}"
PS2="> ${BOLD}"
trap 'echo -ne "${OFF}" > $(tty)' DEBUG

Move the ${BOLD} around to make part of the prompt also bold. If the prompt itself should not be colored, you need the ${OFF} prefix in PS1, otherwise empty lines (pressing enter without having something written) will make the following prompt bold (credits to @Jay, thanks again!)

This adds a debug trap to turn bold format off, so it's quite a hack. Credits (works without group tty on OS X though).

This is a bit of a hack, so use it at your own risk.

Only setting your PS1/PS2 prompts to bold would be easier and just as visible:

PS1="${BOLD}\u@\h:\w \$${OFF}"
PS2="${BOLD}>${OFF} "
share|improve this answer
Not ~/.bash_profile, but ~/.bashrc (or both, if you don't source .bashrc from .bash_profile). These settings need to be set for each interactive instance of bash, and .bash_profile is read only by login shells. – Gilles Oct 27 '10 at 18:16
Thanks, will edit my answer. I have no bashrc, so I used what was there. – Daniel Beck Oct 27 '10 at 18:20
I figured it out, put an ${OFF} at the front: PS1="${OFF}\u@\h:\w \$${BOLD}" – Jay Oct 27 '10 at 18:41
@Daniel: There shouldn't be an underscore in ~/.bashrc. – Dennis Williamson Oct 27 '10 at 19:27

I had a little trouble with the solutions here while using El Capitan (esp. in iTerm2 but in plain old Terminal as well). I got two sorts of errors:

  1. The ability to delete my bash prompt entirely by just pressing space then backspace
  2. Unwanted characters finding their way into my bash output, e.g. the input pwd would result in


    or in


I propose the following solution, which is really just more of the same.

    PS1="${OFF}\u@\h :${BOLD}"
    PS2="> ${BOLD}"
    trap 'echo -ne "${OFF}" > $(tty)' DEBUG
share|improve this answer
Nice job! Just a few minor differences, but I'm glad you discovered a way for this to work with El Captain. – DrZoo Apr 12 at 17:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.