Darkland | net

ANSI Colors

Published on 17 July, 2013 by amj

ANSI Color Tables:
Reference: https://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
Color
Attribute
Foreground
Value
Background
Value
Black3040
Red3141
Green3242
Yellow3343
Blue3444
Magenta3545
Cyan3646
White3747
Text AttributeValue
None0
High Intensity
(bold)
1
Underline
(monochrome display only)
4
Blink5
Reverse7
Invisible8

This: PS1='${debian_chroot:+($debian_chroot)}\[\033[01;33m\]\u\[\033[0m\]@\[\033[01;32m\]\h\[\033[0m\]:\w\$equals—essentially—this:user@localhost:~$
Other uses:
#!/bin/bash
thishost=$HOSTNAME cd $HOME printf "\33[1;33mThis is a great song\33[0m\33[1m:\33[0m \33[1;34mEternal Nightmare -- Little Copy\33[0m \33[1m--amj\33[0m\n\n" sudo -nv 2> /dev/null if [ $? = 1 ]; then printf "\33[1;33mPlease enter your password\nto run updates for\33[0m \33[1;32m$thishost\33[0m.\n\n" fi sudo apt-get update printf "\n\33[1;32m$thishost\33[1;33m is currently running kernel version\33[0m\33[1m:\33[34m "; uname -r printf "\33[0m\n" sudo apt-get dist-upgrade cd -
See also:Tweaks And That Sort Of Jive


Back