Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

Possible Duplicate:
Customizing bash shell: Bold/color the command

bash $ cat what-i-want
"I want the output be in a different color."

I'd like my commands stand out among the output, without making the prompt overly long. I want to see commands and output in different colors. I understand how to manipulate prompt colors by setting PS1.

Is there a way to change color after I pressed Enter but before the command started executing?

share|improve this question

marked as duplicate by derobert, jasonwryan, Renan, Gilles, Mat Nov 29 '12 at 8:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

possible duplicate – jw013 Nov 28 '12 at 16:30

You could probably use the bind command of bash / readline to do something on Enter (I believe I have seen it mentioned on this site recently, but I'm unable to find it atm).

Another option is creating an alias, you would prepend in front of the command:

$ alias x='echo <ANSI ESCAPE>;'
$ x cat what-you-want

As Kevin pointed out, remember to reset the colour at the beginning of your prompt.

share|improve this answer
You'd have to add a color reset escape to the beginning of the prompt. – Kevin Nov 28 '12 at 17:03
Regarding “do something on Enter” – note that 1) Enter not always executes the command; 2) not always Enter executes the command. – manatwork Nov 28 '12 at 17:18

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