wizard10000

root .bashrc prompt colors

Aug 8th, 2021 (edited)
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.70 KB | None | 0 0
  1. # ~/.bashrc: executed by bash(1) for non-login shells.
  2. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
  3. # for examples
  4.  
  5. # If not running interactively, don't do anything
  6. case $- in
  7.     *i*) ;;
  8.       *) return;;
  9. esac
  10.  
  11. # add !/.local/bin to path
  12.  
  13. export PATH=$PATH:~/.local/bin
  14.  
  15. # don't put duplicate lines or lines starting with space in the history.
  16. # See bash(1) for more options
  17. # HISTCONTROL=ignoreboth
  18. HISTCONTROL=ignoreboth
  19.  
  20. # append to the history file, don't overwrite it
  21. shopt -s histappend
  22.  
  23. # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
  24. HISTSIZE=1000
  25. HISTFILESIZE=2000
  26.  
  27. # check the window size after each command and, if necessary,
  28. # update the values of LINES and COLUMNS.
  29. shopt -s checkwinsize
  30.  
  31. # If set, the pattern "**" used in a pathname expansion context will
  32. # match all files and zero or more directories and subdirectories.
  33. #shopt -s globstar
  34.  
  35. # make less more friendly for non-text input files, see lesspipe(1)
  36. #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  37.  
  38. # set variable identifying the chroot you work in (used in the prompt below)
  39. if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
  40.     debian_chroot=$(cat /etc/debian_chroot)
  41. fi
  42.  
  43. # set a fancy prompt (non-color, unless we know we "want" color)
  44. case "$TERM" in
  45.     xterm-color) color_prompt=yes;;
  46. esac
  47.  
  48. # uncomment for a colored prompt, if the terminal has the capability; turned
  49. # off by default to not distract the user: the focus in a terminal window
  50. # should be on the output of commands, not on the prompt
  51. force_color_prompt=yes
  52.  
  53. if [ -n "$force_color_prompt" ]; then
  54.     if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
  55.     # We have color support; assume it's compliant with Ecma-48
  56.     # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
  57.     # a case would tend to support setf rather than setaf.)
  58.     color_prompt=yes
  59.     else
  60.     color_prompt=
  61.     fi
  62. fi
  63.  
  64. if [ "$color_prompt" = yes ]; then
  65.     # comment this out if user *is not* root
  66.     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  67.     # comment this out if user *is* root
  68.     # PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  69. else
  70.     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
  71. fi
  72. unset color_prompt force_color_prompt
  73.  
  74. # If this is an xterm set the title to user@host:dir
  75. case "$TERM" in
  76. xterm*|rxvt*)
  77.     PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
  78.     ;;
  79. *)
  80.     ;;
  81. esac
  82.  
  83. # enable color support of ls and also add handy aliases
  84. if [ -x /usr/bin/dircolors ]; then
  85.     test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
  86.     alias ls='ls --color=auto'
  87.     #alias dir='dir --color=auto'
  88.     #alias vdir='vdir --color=auto'
  89.  
  90.     #alias grep='grep --color=auto'
  91.     #alias fgrep='fgrep --color=auto'
  92.     #alias egrep='egrep --color=auto'
  93. fi
  94.  
  95. # some more ls aliases
  96. #alias ll='ls -l'
  97. #alias la='ls -A'
  98. #alias l='ls -CF'
  99.  
  100. # Alias definitions.
  101. # You may want to put all your additions into a separate file like
  102. # ~/.bash_aliases, instead of adding them here directly.
  103. # See /usr/share/doc/bash-doc/examples in the bash-doc package.
  104.  
  105. if [ -f ~/.bash_aliases ]; then
  106.     . ~/.bash_aliases
  107. fi
  108.  
  109. # enable programmable completion features (you don't need to enable
  110. # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
  111. # sources /etc/bash.bashrc).
  112. if ! shopt -oq posix; then
  113.   if [ -f /usr/share/bash-completion/bash_completion ]; then
  114.     . /usr/share/bash-completion/bash_completion
  115.   elif [ -f /etc/bash_completion ]; then
  116.     . /etc/bash_completion
  117.   fi
  118. fi
  119.  
Add Comment
Please, Sign In to add comment