BeefJurky
BeefJurky

Reputation: 63

Command line and output a different color in Mac terminal?

Is there any way to make the command line prompt on Mac Terminal be a different color than the output? Right now, everything is the same color and it makes it hard to follow sometimes.

I have used Vagrant though and now I want my command line to stick out from the rest of the output text in my standard Mac Terminal. I do know how to change its color, but that is the color shared between the terminal output and the prompt

Upvotes: 6

Views: 6404

Answers (2)

Carlos Orduño
Carlos Orduño

Reputation: 21

you can change it by modifying your bash_profile, and include your preferences on it:

option 1 result: [time user_in_red@host_in_purple ~/Directory_in_your_computer_color ] $ commands_with_your_computer_settings

PS1="[\t \[$(tput setaf 9)\]\u\[$(tput setaf 15)\]@\[$(tput setaf 12)\]\h \[$(tput sgr0)\]\w ] \$ "

option 2 result: @User_green_color~/Directory_in_green _color $ your_commands_with_your_computer_settings

PS1="@\[$(tput setaf 2)\]\u\[$(tput setaf 2)\]\w\$(tput sgr0)\] \$ "

You can create your own settings depending on your needs. for example this is the user in color 2 green.

[$(tput setaf 2)\]\u

In order to modify your bash_profile type this from your terminal.

nano ~/.bash_profile

once is open paste your settings, one of the options above or one that you have created.

Save it and close it. Control+x to close it, select "y" to save changes and then enter to close it.

close your terminal and open a new one, you should be able to see your changes.

for other colors:

0 – Black.

1 – Red.

2 – Green.

3 – Yellow.

4 – Blue.

5 – Magenta.

6 – Cyan.

7 – White.

Upvotes: 0

Bun
Bun

Reputation: 3137

I'm using iTerm2, and customize the color scheme with iterm2colorschemes.

Upvotes: 2

Related Questions