read


For mac use .bash_profile file
For Linux use .bashrc file

Create .bash_profile(Do this only if you dont have a “~/.bash_profile” file)

Open a terminal and enter:
<blockquote>cd ~
touch .bash_profile</blockquote>
Customize colors and info in terminal prompt

Open the .bash_profile with:

<blockquote>open -e .bash_profile</blockquote>

Add one or the numbers of the next colors (lines, in this example the Cyan and NC is added) that you would use:

<blockquote>#Color definitions
Black=”$(tput setaf 0)”
BlackBG=”$(tput setab 0)”
DarkGrey=”$(tput bold ; tput setaf 0)”
LightGrey=”$(tput setaf 7)”
LightGreyBG=”$(tput setab 7)”
White=”$(tput bold ; tput setaf 7)”
Red=”$(tput setaf 1)”
RedBG=”$(tput setab 1)”
LightRed=”$(tput bold ; tput setaf 1)”
Green=”$(tput setaf 2)”
GreenBG=”$(tput setab 2)”
LightGreen=”$(tput bold ; tput setaf 2)”
Brown=”$(tput setaf 3)”
BrownBG=”$(tput setab 3)”
Yellow=”$(tput bold ; tput setaf 3)”
Blue=”$(tput setaf 4)”
BlueBG=”$(tput setab 4)”
LightBlue=”$(tput bold ; tput setaf 4)”
Purple=”$(tput setaf 5)”
PurpleBG=”$(tput setab 5)”
Pink=”$(tput bold ; tput setaf 5)”
Cyan=”$(tput setaf 6)”
CyanBG=”$(tput setab 6)”
LightCyan=”$(tput bold ; tput setaf 6)”
NC=”$(tput sgr0)” # No Color</blockquote>

Then add the next line:
<blockquote>
#Change terminal colors
export PS1=”$Cyan\nWhere-> \w\n\$[$NC]”</blockquote>

The first lines are definitions for each colors and then you modify the PS1 variable that contains what is show in the terminal
prompt info.

More info to the PS1

Between the quotation marks, you can add the following lines to customize your Terminal prompt:

\d – Current date
\t – Current time
\h – Host name
# – Command number
\u – User name
\W – Current working directory (ie: Desktop/)
\w – Current working directory, full path (ie: /Users/Admin/Desktop)


Other

If you dont like that Cyan color… you can change the “$Cyan” text in the export for the name of the color you want.

If you let this colors equal you will make your terminal look like this:



For me I use:

<pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"> # Colors
Cyan="$(tput setaf 6)"
NC="$(tput sgr0)" # No Color
export PS1="$Cyan\nWhere-> \w\n\\$\[$NC\]"
</pre>

Source = http://osxdaily.com/2006/12/11/how-to-customize-your-terminal-prompt/

Blog Logo

Daniel Gomez Rico


Published

Image

MakinGIANTS

The findings and tips records of an Android-iOS-TheWholeShabang group

Back to Overview