Configuring OSX Terminal PromptFiled under: programming
Now that I’m spending more time working with the terminal, it became important to customize the look for a more pleasing computing experience. While entering numerous commands for brew, pip, git, etc. it was difficult to see where my cursor is so I wanted to bold the command prompt.
CLICOLOR turns on the feature for customizing colors. Value of 1 turns it on. LCOLORS lets you set specific properties.
# Modify Terminal Colors in ~/.bash_profile CLICOLOR=1 LCOLORS="exfxcxdxbxegedabagacad"
The output would have some of the following characters: \u: Display the current username . \h: Display the hostname \W: Print the base of current working directory. : Display # (indicates root user) if the effective UID is 0, otherwise display a .
Settings can be edited in ~/.bash_profile
export PS1="\e[0;31m[\u@\h \W]\ \e[m"
The basics include foreground and background colors.
Color Code Black 0;30 Blue 0;34 Green 0;32 Cyan 0;36 Red 0;31 Purple 0;35
Coincidentally I was sitting with some commandline gurus who overheard me fiddling around with PS1 settings and pointed me to something called the ‘the sexy bash prompt’. This requires adding a ~/.bash_prompt file to your directory [/Users/yourfolder/.bash_prompt].
Be specific with your search query… i.e., use words ‘bash prompt’ rather than generic terms of ‘terminal customization’.
You can place these settings in any of ~/.bash_profile, ~/.bashrc, ~/.bash_prompt but only one. Also, have one central file that calls on the others to keep things tidy.