Skip to content

Marina Mele's site

Reflections on family, values, and personal growth

Menu
  • Home
  • About
Menu

Customize the colors of your Terminal in Mac OS X

Posted on May 4, 2014September 26, 2014 by Marina Mele

This post explains how you can change the color of the Terminal prompt in Mac OS X.
It also covers how to activate the Terminal color layout, a very useful feature that displays different colors depending on the character of the file or folder.

Change the color of the Terminal prompt

To change the color of the Terminal prompt to a green color, open or create the file ~/.bash_profile and write:

#PS1='[\u@\h \W]\$ ‘  # Default
PS1=’\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] ‘

where the first line is a comment indicating the default value, and

  • \e[1;31m indicates Red color
  • \u @ \h \W indicates the format of the prompt: user@host path.
  • \e[0m indicates format text reset

You can find more information about these special characters in this link. To activate these changes open and close the terminal, or run

source ~/.bash_profile

Activate colors in your Terminal

Activate colors is very easy. You only need to open the ~/.bash_profile file and add the following line:

export CLICOLOR=1

Save the file, and activate the changes like before.

Change the colors of your Terminal

Now, let’s learn how we can configure our Terminal to obtain the colors of the figure.

Terminal custom colors

Colors can be changed using the LSCOLORS variable in the ~/.bash_profile. By default is set to

LSCOLORS=exfxcxdxbxegedabagacad

where the string exfxcxdxbxegedabagacad is a concatenation of pairs of the format TB, where T is the text color and B is the Background color.

The order of these pairs correspond to:

  1. directory
  2. symbolic link – special kind of file that contains a reference to another file or directory.
  3. socket – special kind of file used for inter-process communication.
  4. pipe – special file that connects the output of one process to the input of another.
  5. executable
  6. block special – a kind of device file.
  7. character special – a kind of device file.
  8. executable with setuid bit set (setuid is a short for set user ID upon execution).
  9. executable with setgid bit set (setgid is a short for set group ID upon execution).
  10. directory writable to others, with sticky bit – only the owner can rename or delete files.
  11. directory writable to others, without sticky bit – any user with write and execution permissions can rename or delete files.

And the different letters correspond to:

  • a black
  • b red
  • c green
  • d brown
  • e blue
  • f magenta
  • g cyan
  • h light grey
  • x default color

The same letters in uppercase indicate Bold.

The Terminal default colors, described by exfxcxdxbxegedabagacad, and ordered by file type / text color / background color, are:

  1. ex –> directory / blue / default
  2. fx –> symbolic link / magenta / default
  3. cx –> socket / green / default
  4. dx –> pipe / brown / default
  5. bx –> executable / red / default
  6. eg –> block special / blue / cyan
  7. ed –> character special / blue / brown
  8. ab –> executable with setuid / black / red
  9. ag –> executable without setuid / black / cyan
  10. ac –> directory with sticky / black / green
  11. ad –> directory without sticky / black / brown

You can change the colors of your terminal by creating a new concatenated string, like
GxFxCxDxBxegedabagaced, and writing in the .bash_profile file the following line:

export LSCOLORS=GxFxCxDxBxegedabagaced

Enjoy the new Terminal layout! 😉

Don’t forget to g+1 if useful! Thanks!

Marina Melé
Marina Mele

Marina Mele has experience in artificial intelligence implementation and has led tech teams for over a decade. On her personal blog (marinamele.com), she writes about personal growth, family values, AI, and other topics she’s passionate about. Marina also publishes a weekly AI newsletter featuring the latest advancements and innovations in the field (marinamele.substack.com)

Leave a Reply Cancel reply

You must be logged in to post a comment.

Categories

  • Personal Growth and Development
  • Artificial Intelligence
  • Mindful Parenting and Family Life
  • Productivity and Time Management
  • Mindfulness and Wellness
  • Values and Life Lessons
  • Posts en català
  • Other things to learn

Recent Posts

  • Understanding Frustration in Children
  • What is ChatGPT and how it compares to Bard and Claude
  • BlueSky Social – A Sneak Peek at the Future of Social Media
  • The Incredible Journey of AI Image Generation
  • AI and Fundamental Rights: How the AI Act Aims to Protect Individuals

RSS

  • Entries RSS
Follow @marina_mele
  • Cookie Policy
  • Privacy Policy
©2025 Marina Mele's site | Built using WordPress and Responsive Blogily theme by Superb
This website uses cookies to improve your experience. If you keep navigating through this website, we'll assume you're ok with this, but you can opt-out if you wish.Accept Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT