Ubuntu Bash

Ubuntu Bash
Итак на сей раз его потребовалось раскрасить и сделать поинформативнее.
Задать немного цветов bash.
Основное это различать наглядно под кем сейчас есть. Под пользователем или рутом.

Ubuntu Bash

Привожу конфиг .bashrc
Ввиду того что во время поста разметка съедет, выкладываю конфиг отдельно.
Скачать конфиг

======================================================================================================

#==============================================================================
# Справка по переменным
#==============================================================================
#  \a         an ASCII bell character (07)
#  \d         the date in "Weekday Month Date" format (e.g., "Tue May 26")
#  \D{format} the format is passed to strftime(3) and the result
#             is inserted into the prompt string an empty format
#             results in a locale-specific time representation.
#             The braces are required
#  \e         an ASCII escape character (033)
#  \h         the hostname up to the first `.'
#  \H         the hostname
#  \j         the number of jobs currently managed by the shell
#  \l         the basename of the shell's terminal device name
#  \n         newline
#  \r         carriage return
#  \s         the name of the shell, the basename of $0 (the portion following
#             the final slash)
#  \t         the current time in 24-hour HH:MM:SS format
#  \T         the current time in 12-hour HH:MM:SS format
#  \@         the current time in 12-hour am/pm format
#  \A         the current time in 24-hour HH:MM format
#  \u         the username of the current user
#  \v         the version of bash (e.g., 2.00)
#  \V         the release of bash, version + patch level (e.g., 2.00.0)
#  \w         the current working directory, with $HOME abbreviated with a tilde
#  \W         the basename of the current working directory, with $HOME
#             abbreviated with a tilde
#  \!         the history number of this command
#  \#         the command number of this command
#  \$         if the effective UID is 0, a #, otherwise a $
#  \nnn       the character corresponding to the octal number nnn
#  \\         a backslash
#  \[         begin a sequence of non-printing characters, which could be used
#             to embed a terminal control sequence into the prompt
#  \]         end a sequence of non-printing characters
#
#==============================================================================
# Раскрашиваем МАНЫ
#==============================================================================
#
#=========================================================================
#   Самая распространенная в Internet`е цветовая схема:
#=========================================================================
#   export LESS_TERMCAP_mb=$'\033[01;31m'
#   export LESS_TERMCAP_md=$'\033[01;31m'
#   export LESS_TERMCAP_me=$'\033[0m'
#   export LESS_TERMCAP_se=$'\033[0m'
#   export LESS_TERMCAP_so=$'\033[01;44;33m'
#   export LESS_TERMCAP_ue=$'\033[0m'
#   export LESS_TERMCAP_us=$'\033[01;32m'
#=========================================================================
#   Зелено-голубая цветовая схема:
#=========================================================================
    export LESS_TERMCAP_mb=$'\033[01;36m'
    export LESS_TERMCAP_md=$'\033[01;32m'
    export LESS_TERMCAP_me=$'\033[0m'
    export LESS_TERMCAP_mu=$'\033[01;37m'
    export LESS_TERMCAP_se=$'\033[0m'
    export LESS_TERMCAP_so=$'\033[01;44;33m'
    export LESS_TERMCAP_ue=$'\033[0m'
    export LESS_TERMCAP_us=$'\033[01;36m'
#=========================================================================
#   Сине-сереневая цветовая схема:
#=========================================================================
#   export LESS_TERMCAP_mb=$'\033[01;31m'
#   export LESS_TERMCAP_md=$'\033[01;38;5;74m'
#   export LESS_TERMCAP_me=$'\033[0m'
#   export LESS_TERMCAP_se=$'\033[0m'
#   export LESS_TERMCAP_so=$'\033[38;5;246m'
#   export LESS_TERMCAP_ue=$'\033[0m'
#   export LESS_TERMCAP_us=$'\033[04;38;5;146m'
#=========================================================================
#   Зелено-сереневая цветовая схема:
#=========================================================================
#   export LESS_TERMCAP_md=$'\033[1;32m'
#   export LESS_TERMCAP_me=$'\033[0m'
#   export LESS_TERMCAP_us=$'\033[0;35m'
#   export LESS_TERMCAP_ue=$'\033[0m'
#   export LESS_TERMCAP_mb=$'\033[1;33m'
#   export LESS_TERMCAP_so=$'\033[1;33m'
#   export LESS_TERMCAP_se=$'\033[0m'
#
#==============================================================================
# Определяем переменные для цветов
#==============================================================================
#
#Памятка, Таблица цветов и фонов
#=======================================
#Цвет       код          код фона
#=======================================
#black    30  40    \033[30m  \033[40m
#red      31  41    \033[31m  \033[41m
#green    32  42    \033[32m  \033[42m
#yellow   33  43    \033[33m  \033[43m
#blue     34  44    \033[34m  \033[44m
#magenta  35  45    \033[35m  \033[45m
#cyan     36  46    \033[36m  \033[46m
#white    37  47    \033[37m  \033[47m

# Дополнительные свойства для текта:
#=======================================
BOLD='\033[1m'       	#  ${BOLD} 		# жирный шрифт (интенсивный цвет)
DBOLD='\033[2m'      	#  ${DBOLD}    		# полу яркий цвет (тёмно-серый, независимо от цвета)
NBOLD='\033[22m'      	#  ${NBOLD}     	# установить нормальную интенсивность
UNDERLINE='\033[4m'     #  ${UNDERLINE} 	# подчеркивание
NUNDERLINE='\033[4m'    #  ${NUNDERLINE}	# отменить подчеркивание
BLINK='\033[5m'       	#  ${BLINK}    		# мигающий
NBLINK='\033[5m'       	#  ${NBLINK}    	# отменить мигание
INVERSE='\033[7m'     	#  ${INVERSE}   	# реверсия (знаки приобретают цвет фона, а фон -- цвет знаков)
NINVERSE='\033[7m'     	#  ${NINVERSE}  	# отменить реверсию
BREAK='\033[m'       	#  ${BREAK}    		# все атрибуты по умолчанию
NORMAL='\033[0m'      	#  ${NORMAL}    	# все атрибуты по умолчанию

# Цвет текста:
#=======================================
BLACK='\033[0;30m'     	#  ${BLACK}    		# чёрный цвет знаков
RED='\033[0;31m'       	#  ${RED}      		# красный цвет знаков
GREEN='\033[0;32m'     	#  ${GREEN}    		# зелёный цвет знаков
YELLOW='\033[0;33m'     #  ${YELLOW}    	# желтый цвет знаков
BLUE='\033[0;34m'       #  ${BLUE}      	# синий цвет знаков
MAGENTA='\033[0;35m'    #  ${MAGENTA}   	# фиолетовый цвет знаков
CYAN='\033[0;36m'       #  ${CYAN}      	# цвет морской волны знаков
GRAY='\033[0;37m'       #  ${GRAY}      	# серый цвет знаков

# Цветом текста (жирным) (bold) :
#=======================================
DEF='\033[0;39m'       	#  ${LDEF}
DGRAY='\033[1;30m'     	#  ${LDGRAY}
LRED='\033[1;31m'       #  ${LRED}
LGREEN='\033[1;32m'     #  ${LGREEN}
LYELLOW='\033[1;33m'    #  ${LYELLOW}
LBLUE='\033[1;34m'     	#  ${LBLUE}
LMAGENTA='\033[1;35m'   #  ${LMAGENTA}
LCYAN='\033[1;36m'     	#  ${LCYAN}
WHITE='\033[1;37m'     	#  ${LWHITE}

# Цвет фона:
#=======================================
BGBLACK='\033[40m'     	#  ${BGBLACK}
BGRED='\033[41m'       	#  ${BGRED}
BGGREEN='\033[42m'     	#  ${BGGREEN}
BGBROWN='\033[43m'     	#  ${BGBROWN}
BGBLUE='\033[44m'     	#  ${BGBLUE}
BGMAGENTA='\033[45m'    #  ${BGMAGENTA}
BGCYAN='\033[46m'     	#  ${BGCYAN}
BGGRAY='\033[47m'     	#  ${BGGRAY}
BGDEF='\033[49m'      	#  ${BGDEF}
#
#===============================================================================================
# Задаем параметры истории и отображения
#===============================================================================================
HISTCONTROL=ignoredups:ignorespace
shopt -s histappend
HISTSIZE=3000
HISTFILESIZE=3000
shopt -s checkwinsize
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

#===============================================================================================
# Задаем приглашение для пользователя и рута
#==============================================================================
if [ `id -un` = root ]; then
  PS1="┌ ${RED}\u@\h${BREAK} [${LMAGENTA}\w${BREAK}] \n└─ \$ "
 else
PS1="┌ ${GREEN}\u@\h${BREAK} [${LMAGENTA}\w${BREAK}] \n└─ \$ "
fi

#===============================================================================================
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

3 комментария

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *