Mac os terminal colors

Marina Mele’s site

Learn about Python, Django, Marketing and Science

Customize the colors of your Terminal in Mac OS X

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:

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

Activate colors in your Terminal

Activate colors is very easy. You only need to open the

/.bash_profile file and add the following line:

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.

Colors can be changed using the LSCOLORS variable in the

/.bash_profile . By default is set to

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
Читайте также:  После обновления windows 10 не печатает принтер samsung

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:

Enjoy the new Terminal layout! 😉

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

Please, add +Marina Mele in your comments. This way I will get a notification email and I will answer you as soon as possible! 🙂

Источник

AtmaMani / mac-terminal-colors.md

Get your mac terminal to utilize full color palette

1. Edit bash_profile

The color profile of your terminal is stored in .barsh_profile in your home directory. Lets edit that in your terminal:

or if you have sublime text installed using homebrew then:

Note: you may have to prefix sudo before the nano command. Once the nano text editor opens, paste the following

Follow the key sequence at the bottom of nano to save and quit (Ctrl + O and Ctrl + X). With this, you should see some basic coloring for your name prompt and commands like ls . Reopen terminal for this to take effect.

2. Modify terminal prompt display information

Your prompt by default displays the username, and the file path. However if you are the only person using it, then some of this is redundant and takes up space when your work on long paths. To change this and to decorate the prompt with GIT branch names and local status, append the following to the same

3. Customize in preferences

You can customize terminal further through preferences dialog. To open, use shortcut cmd + k .

In the profiles tab, click on a theme. Ensure the checkboxes under Text section are enabled. You can try out the opacity, text color combinations to suit your preferences.

3. Tab autocomplete

Improve the tab autocomplete so it suggests no matter the case and even if there are ambiguous results. Help link Open

then type the following and save

3.1 Tab autocomplete for GIT

Enhance the autocomplete to list GIT branch names, GIT commands as well by appending the following to the

Then follow the instructions at the end to add the string to your bash_profile . Restart terminal.

Источник

How to enable colorized output for ls command in MacOS X Terminal

I am new to macOS or Apple OS X. How do I enable colorized output for my ls command on Apple Mac OS X just like the ones that shown on my Ubuntu Linux server? How do I configure Mac OS X Terminal app to have color ls output?

You can enable colorized output by passing the -G option to ls command on Apple Mac OS X or FreeBSD operating system. You don’t have to install anything special. Just pass the -G option to the ls command to enable colorized output on Unix box.

Tutorial details
Difficulty level Easy
Root privileges No
Requirements macOS latest or macOS X with bash/zsh
Est. reading time 2m

Mac OS X color ls output option

Open the terminal application and simply type the following command:
$ ls -G

Fig,01: OS X ls command in action

Configure

/.bash_profile to display colorful ls command

When bash is your login shell, it looks for

/.profile file in that order. When an interactive shell that is not a login shell is started, Bash reads and executes commands from

/.bashrc. Hence you must add commands to

Want to enable colorized output permanently? You need to add the following command in the

/.bash_profile file:
$ vi

/.bash_profile
Append the following alias:

Save and close the file. Source the changes immediately:
$ source

/.bashrc
OR
$ source

/.bash_profile
Test it:
$ ls
$ ll

How do I skip colorful ls command output temporarily?

Simply run the ls command as follows:
$ \ls
$ \ls -l

The -G option is equivalent to defining CLICOLOR in the environment. The ls command supports the following environment variables:

  1. CLICOLOR – Use ANSI color sequences to distinguish file types.
  2. LSCOLORS – The value of this variable describes what color to use for which attribute when colors are enabled with CLICOLOR

Just type the following command to enable colorized output for the ls command:

Understanding LSCOLORS values

You can define color for each attribute with the help of LSCOLORS, when colors are enabled with CLICOLOR. This string is a concatenation of pairs of the format fb, where f is the foreground color and b is the background color. The default value is:

ls Attribute Foreground color Background color
directory e x
symbolic f x
socket c x
pipe d x
executable b x
block e g
character e d
executable a b
executable a g
directory a c
directory a d

The color and their code values are as follows:

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

Code Meaning (Color)
a Black
b Red
c Green
d Brown
e Blue
f Magenta
g Cyan
h Light grey
A Bold black, usually shows up as dark grey
B Bold red
C Bold green
D Bold brown, usually shows up as yellow
E Bold blue
F Bold magenta
G Bold cyan
H Bold light grey; looks like bright white
x Default foreground or background

You can now customize it as per your need in

Источник

Изменение настроек текста для профиля в Терминале на Mac

В панели «Текст» в настройках Терминала можно изменить шрифт, текст, цвет и параметры курсора для профиля окна Терминала.

Чтобы изменить эти настройки в Терминале на Mac, выберите меню «Терминал» > «Настройки», нажмите «Профили», выберите профиль, затем нажмите «Текст».

Примечание. Параметры, выбранные в этой панели настроек, применяются только к выбранному профилю. Они не применяются ко всему приложению «Терминал».

Изменение параметров фона.

Цвет и эффекты. Нажмите цветовую область, затем выберите цвет. Чтобы сделать окно Терминала прозрачным или полупрозрачным, используйте бегунки регулировки прозрачности и размытия.

Чтобы настроить прозрачность и размытие фоновых окон, выберите «Неактивные окна», затем используйте соответствующие бегунки для регулировки.

Изображение. Нажмите всплывающее меню «Изображение», нажмите «Выбрать», затем выберите изображение.

Чтобы изменить шрифт, нажмите «Изменить» в разделе «Шрифт», затем выберите шрифт, гарнитуру и размер.

Изменение способа отображения текста.

Сглаженный шрифт. К тексту применяется сглаживание.

Использовать жирные шрифты. Для выделения текста используется жирный шрифт.

Разрешить мигающий текст. Текст может мигать.

Показать цвета ANSI. Текст отображается цветами, встроенными в стандарты некоторых эмуляторов терминала.

Использовать яркие цвета для жирного шрифта. Текст, выделенный жирным шрифтом, дополнительно выделяется цветом.

Текст. Изменение цвета текста. Нажмите цветовую область, затем выберите цвет.

Жирный шрифт. Изменение цвета текста, выделенного жирным шрифтом. Нажмите цветовую область, затем выберите цвет.

Выбор. Изменение цвета выбранного текста. Нажмите цветовую область, затем выберите цвет.

Чтобы настроить цвет ANSI, нажмите область цвета, затем выберите цвет.

Изменение внешнего вида курсора.

Блок, Подчеркивание, Вертикальная полоса. Изменение формы курсора.

Мигание курсора. Включение мигания курсора.

Курсор. Настройка цвета курсора. Нажмите цветовую область, затем выберите цвет.

Источник

Add Color to the Terminal in Mac OS X

Adding colorized ls output to the Terminal in Mac OS X is a good way to make navigating around the command line a bit easier on the eyes. This makes different items show up in different colors, including directories, files, executables, and symbolic links.

How to Add Color ‘ls’ Command Output in Mac OS X Terminal

We’ll cover a customizable color output setting for both dark and light terminals, and you can get a preview of color ls output by typing “ls -G” at the command line. The preview with ls -G will depend on the Terminals color settings and won’t necessarily represent the colors shown in the screenshots below, however.

  • Open Terminal and type: nano .bash_profile
  • Use the arrow keys to navigate to the bottom of the document and paste in either of the blocks of text below, depending on the terminals appearance (see man entry below for further customizations)

Colors for Dark Terminal Themes:
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

Colors for Light Terminal Themes:
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad

    After the strings are pasted into .bash_profile confirm that it looks something like this in nano:

  • Hit Control+O to save and open a new Terminal window
  • Type “ls” or “ls -la” to confirm the colorized output
  • Optionally, you may want to create an alias in .bash_profile to link ls to something like ls -GFh, this would look like:

    This will work with Mac OS X 10.6, OS X 10.7, OS X 10.8, and beyond, as long as you are using the bash shell. If you aren’t certain what shell you are using, look in the Terminal window titlebar for “bash”, or you can check with the following command:

    The output will be “/bin/bash” if it’s bash, and something else if not.

    Don’t forget that you can also change the appearance of Terminal windows instantly and change the Terminal wallpaper too.

    Customizing LSCOLORS Manually
    If the above color choices weren’t doing it for you, you can set whatever you want. Here’s the manual page on LSCOLORS if you want to give it a shot. The default is “exfxcxdxbxegedabagacad” but clearing out the .bash_profile color entry will remove any hideous color combinations too.

    LSCOLORS The value of this variable describes what color to use
    for which attribute when colors are enabled with
    CLICOLOR. This string is a concatenation of pairs of the
    format fb, where f is the foreground color and b is the
    background color.

    The color designators are as follows:

    a black
    b red
    c green
    d brown
    e blue
    f magenta
    g cyan
    h light grey
    A bold black, usually shows up as dark grey
    B bold red
    C bold green
    D bold brown, usually shows up as yellow
    E bold blue
    F bold magenta
    G bold cyan
    H bold light grey; looks like bright white
    x default foreground or background

    Note that the above are standard ANSI colors. The actual
    display may differ depending on the color capabilities of
    the terminal in use.

    The order of the attributes are as follows:

    1. directory
    2. symbolic link
    3. socket
    4. pipe
    5. executable
    6. block special
    7. character special
    8. executable with setuid bit set
    9. executable with setgid bit set
    10. directory writable to others, with sticky bit
    11. directory writable to others, without sticky
    bit

    Источник

    Читайте также:  Оригинальный фон рабочего стола windows 10
    Оцените статью