quarta-feira, 8 de maio de 2013

on

Para deixar o texto no Terminal do Ubuntu colorido, digite:
  • sudo gedit ~/.bashrc
Procure pela linha:
  • #force_color_prompt=yes e tire o símbolo #.
Agora basta salvar e sair. Em seguida abra um terminal e vc verá que o mesmo já estará colorido.

E SE POR ACASO OS ARQUIVOS NÃO EXISTIREM, COMO FOI MEU CASO, SIGA OS PRÓXIMOS PASSOS.

1 - crie os arquivos
  • touch $HOME/.bash_login
  • touch $HOME/.bashrc
2 - abra com o editor de texto
  • gedit .bashrc
3 - Copie e cole o codigo abaixo:
  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. # If not running interactively, don't do anything
  5. [ -z "$PS1" ] && return

  6. # don't put duplicate lines or lines starting with space in the history.
  7. # See bash(1) for more options
  8. HISTCONTROL=ignoreboth

  9. # append to the history file, don't overwrite it
  10. shopt -s histappend

  11. # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
  12. HISTSIZE=1000
  13. HISTFILESIZE=2000

  14. # check the window size after each command and, if necessary,
  15. # update the values of LINES and COLUMNS.
  16. shopt -s checkwinsize

  17. # If set, the pattern "**" used in a pathname expansion context will
  18. # match all files and zero or more directories and subdirectories.
  19. #shopt -s globstar

  20. # make less more friendly for non-text input files, see lesspipe(1)
  21. [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

  22. # set variable identifying the chroot you work in (used in the prompt below)
  23. if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
  24.     debian_chroot=$(cat /etc/debian_chroot)
  25. fi

  26. # set a fancy prompt (non-color, unless we know we "want" color)
  27. case "$TERM" in
  28.     xterm-color) color_prompt=yes;;
  29. esac

  30. # uncomment for a colored prompt, if the terminal has the capability; turned
  31. # off by default to not distract the user: the focus in a terminal window
  32. # should be on the output of commands, not on the prompt
  33. force_color_prompt=yes

  34. if [ -n "$force_color_prompt" ]; then
  35.     if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
  36. # We have color support; assume it's compliant with Ecma-48
  37. # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
  38. # a case would tend to support setf rather than setaf.)
  39. color_prompt=yes
  40.     else
  41. color_prompt=
  42.     fi
  43. fi

  44. if [ "$color_prompt" = yes ]; then
  45.     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  46. else
  47.     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
  48. fi
  49. unset color_prompt force_color_prompt

  50. # If this is an xterm set the title to user@host:dir
  51. case "$TERM" in
  52. xterm*|rxvt*)
  53.     PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
  54.     ;;
  55. *)
  56.     ;;
  57. esac

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

  64.     alias grep='grep --color=auto'
  65.     alias fgrep='fgrep --color=auto'
  66.     alias egrep='egrep --color=auto'
  67. fi

  68. # some more ls aliases
  69. alias ll='ls -alF'
  70. alias la='ls -A'
  71. alias l='ls -CF'

  72. # Add an "alert" alias for long running commands.  Use like so:
  73. #   sleep 10; alert
  74. 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$//'\'')"'

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

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

  82. # enable programmable completion features (you don't need to enable
  83. # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
  84. # sources /etc/bash.bashrc).
  85. if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
  86.     . /etc/bash_completion
  87. fi
Agora basta salvar e sair. Em seguida abra um terminal e vc verá que o mesmo já estará colorido.


PARA QUE O ROOT TAMBEM FIQUE COLORIDO


Para deixar o texto no Terminal do Ubuntu colorido, digite:
  • sudo su
  • # gedit ~/.bashrc
Procure pela linha:
  • #force_color_prompt=yes e tire o símbolo #.
Agora basta salvar e sair. Em seguida abra um terminal como root e vc verá que o mesmo já estará colorido.

E SE POR ACASO OS ARQUIVOS NÃO EXISTIREM, SIGA OS PRÓXIMOS PASSOS.

1 - crie os arquivos
  • sudo su
  • # touch $HOME/.bash_login
  • # touch $HOME/.bashrc
2 - abra com o editor de texto
  • # gedit .bashrc
3 - Copie e cole o codigo abaixo:
  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. # If not running interactively, don't do anything
  5. [ -z "$PS1" ] && return

  6. # don't put duplicate lines or lines starting with space in the history.
  7. # See bash(1) for more options
  8. HISTCONTROL=ignoreboth

  9. # append to the history file, don't overwrite it
  10. shopt -s histappend

  11. # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
  12. HISTSIZE=1000
  13. HISTFILESIZE=2000

  14. # check the window size after each command and, if necessary,
  15. # update the values of LINES and COLUMNS.
  16. shopt -s checkwinsize

  17. # If set, the pattern "**" used in a pathname expansion context will
  18. # match all files and zero or more directories and subdirectories.
  19. #shopt -s globstar

  20. # make less more friendly for non-text input files, see lesspipe(1)
  21. [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

  22. # set variable identifying the chroot you work in (used in the prompt below)
  23. if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
  24.     debian_chroot=$(cat /etc/debian_chroot)
  25. fi

  26. # set a fancy prompt (non-color, unless we know we "want" color)
  27. case "$TERM" in
  28.     xterm-color) color_prompt=yes;;
  29. esac

  30. # uncomment for a colored prompt, if the terminal has the capability; turned
  31. # off by default to not distract the user: the focus in a terminal window
  32. # should be on the output of commands, not on the prompt
  33. force_color_prompt=yes

  34. if [ -n "$force_color_prompt" ]; then
  35.     if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
  36. # We have color support; assume it's compliant with Ecma-48
  37. # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
  38. # a case would tend to support setf rather than setaf.)
  39. color_prompt=yes
  40.     else
  41. color_prompt=
  42.     fi
  43. fi

  44. if [ "$color_prompt" = yes ]; then
  45.     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  46. else
  47.     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
  48. fi
  49. unset color_prompt force_color_prompt

  50. # If this is an xterm set the title to user@host:dir
  51. case "$TERM" in
  52. xterm*|rxvt*)
  53.     PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
  54.     ;;
  55. *)
  56.     ;;
  57. esac

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

  64.     alias grep='grep --color=auto'
  65.     alias fgrep='fgrep --color=auto'
  66.     alias egrep='egrep --color=auto'
  67. fi

  68. # some more ls aliases
  69. alias ll='ls -alF'
  70. alias la='ls -A'
  71. alias l='ls -CF'

  72. # Add an "alert" alias for long running commands.  Use like so:
  73. #   sleep 10; alert
  74. 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$//'\'')"'

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

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

  82. # enable programmable completion features (you don't need to enable
  83. # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
  84. # sources /etc/bash.bashrc).
  85. if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
  86.     . /etc/bash_completion
  87. fi
Agora basta salvar e sair. Em seguida abra um terminal como root e vc verá que o mesmo já estará colorido.

nodes 2013

0 Comente::