|
30-jun-2012 | #1 |
Observador Ingreso: junio-2012
Mensajes: 18
Sexo: País: Signo:
Agradecido: +51
|
Colores y Formato de la consola de Linux
1.- Tambien crea unos alias, siendo los mas relevantes son alias de ls, para listar con las carpetas primero, y todos los archivos, en formato largo. Partiendo de esto es facil personalizar otros alias propios
2.- Ejecutar # dircolors -p > /etc/dircolors 3.- En /root/ o /home/usuario/ editar el archivo .bashrc (hacer siempre copia de seguridad) 4.- Añadir y/o sustituir el siguiente código comentando/descomentando con el # una de las lineas de formato del promt (si se quieren crear formatos propios, en el código esta la explicacion de los elementos con que hacerlo) # ~/.bashrc: executed by bash(1) for non-login shells. ################################################## ################################################## ################################################## ###### COMMAND PROMPT & CLI ###### COMMAND PROMPT & CLI ###### COMMAND PROMPT & CLI ###### COMMAND PROMPT & CLI ###### COMMAND PROMPT & CLI ###### ################################################## ################################################## ################################################## ################################################## # Prompt escapes # ################################################## # Bash allows these prompt strings to be customized by inserting a # number of backslash-escaped special characters that are # decoded as follows: # \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 # # The command number and the history number are usually different: # the history number of a command is its position in the history # list, which may include commands restored from the history file # (see HISTORY below), while the command number is the position in # the sequence of commands executed during the current shell session. # After the string is decoded, it is expanded via parameter # expansion, command substitution, arithmetic expansion, and quote # removal, subject to the value of the promptvars shell option (see # the description of the shopt command under SHELL BUILTIN COMMANDS # below). ################################################## # Color chart # ################################################## # txtblk='\e[0;30m' # Black - Regular # txtred='\e[0;31m' # Red # txtgrn='\e[0;32m' # Green # txtylw='\e[0;33m' # Yellow # txtblu='\e[0;34m' # Blue # txtpur='\e[0;35m' # Purple # txtcyn='\e[0;36m' # Cyan # txtwht='\e[0;37m' # White # bldblk='\e[1;30m' # Black - Bold # bldred='\e[1;31m' # Red # bldgrn='\e[1;32m' # Green # bldylw='\e[1;33m' # Yellow # bldblu='\e[1;34m' # Blue # bldpur='\e[1;35m' # Purple # bldcyn='\e[1;36m' # Cyan # bldwht='\e[1;37m' # White # unkblk='\e[4;30m' # Black - Underline # undred='\e[4;31m' # Red # undgrn='\e[4;32m' # Green # undylw='\e[4;33m' # Yellow # undblu='\e[4;34m' # Blue # undpur='\e[4;35m' # Purple # undcyn='\e[4;36m' # Cyan # undwht='\e[4;37m' # White # bakblk='\e[40m' # Black - Background # bakred='\e[41m' # Red # badgrn='\e[42m' # Green # bakylw='\e[43m' # Yellow # bakblu='\e[44m' # Blue # bakpur='\e[45m' # Purple # bakcyn='\e[46m' # Cyan # bakwht='\e[47m' # White # txtrst='\e[0m' # Text Reset ################################################## # This bashrc's current prompt # ################################################## # Note: PS1 and umask are already set in /etc/profile. You should not # need this unless you want different defaults for root. # PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ ' PS1='\[\e[41m\]\[\e[1;33m\]\[\e[4;33m\] \u\[\e[0m\]\[\e[41m\]\[\e[1;30m\]@\[\e[0m\]\[\e[41m\]\[\e[4;37m\]\H \[\e[0m\]\[\e[47m\]\[\e[1;30m\] [ \w ] \[\e[0m\]\n\[\e[1;37m\]\[\e[44m\]_\$>\[\e[0m\] ' # fondo rojo-blanco bold-fondo blanco-negro bold-reset-blanco fondo verde-reset ### PS1='${debian_chroot:+($debian_chroot)}\[\033[00;31m\]\u@\h\[\033[00m\]:\[\033[01;35m\]\w\[\033[00m\]\$' ### PS1='\[\033[01;31m\]\u\[\033[01;36m\]@\[\033[01;32m\]\h\[\033[01;33m\]:\[\033[01;33m\]\w\n\[\033[01;31m\]\$ \[\033[00;32m\]' # red, cyan, green, yellow with green output ### PS1='\[\033[1;30m\][\[\033[0;37m\]${PIPESTATUS}\[\033[1;30m\]:\[\033[0;37m\]${SHLVL}\[\033[1;30m\]:\[\033[0;37m\]\j\[\033[1;30m\]][\[\033[1;34m\]\u\[\033[0;34m\]@\[\033[1;34m\]\h\[\033[1;30m\]:\[\033[0;37m\]`tty | sed s/\\\\\/dev\\\\\/\//g`\[\033[1;30m\]]\[\033[0;37m\][\[\033[1;37m\]\W\[\033[0;37m\]]\[\033[1;30m\] \$\[\033[00m\] ' # grey and blue with default black output ### PS1="[\!] \033[1;36m[ \u@\h ]\033[1;32m\] [ \t ] [ \d ]\n\033[1;33m\[[ \w ] \033[00m\\n\[\e[30;1m\](\[\e[32;1m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, \$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[30;1m\]) \[\e[0m\] $: " # black, cyan, green, yellow, default black output (2-tier) ### PS1="\[\033[35m\]\t\[\033[m\]-\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ " # purple, cyan, black, green, yellow, default black ### PS1='${debian_chroot:+($debian_chroot)}\[[ \033[01;31m\]\w\[\033[00m\]] ' # basic red with default black output ### PS1="\[\e[37;1m\]-{\[\e[34;1m\]\u@\h\[\e[37;1m\]}-\n\[\e[37;1m\](\[\e[34;1m\]\w: \$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, \$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[37;1m\])\n--> \[\e[0m\]" # grey and cyan w/black output (2-tier) w/dir size ### PS1='\[\e[41m\]\[\e[1;37m\] \u \[\e[47m\]\[\e[1;30m\] \W \[\e[0m\]\[\e[1;37m\]\[\e[42m\] # \[\033[0m\] ' # red, grey, green boxed with default black ### PS1='\[\e[45m\]\[\e[1;37m\] \u@\h \[\e[47m\]\[\e[1;30m\] \W \[\e[0m\]\[\e[1;37m\]\[\e[42m\] > \[\033[0m\] ' # purple, grey, green boxed with default black # PS1='\[\033]0;\w\007\]\[\e[35;1m\]\u\[\e[0m\]\[\e[32m\]@\h\[\e[34m\]\w \[\e[33m\]\$ \[\e[0m\]' # purple, green, blue prompt w/default black & dir title # PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] " # green and blue prompt with pc name & default black output # PS1="\[\033[0;31m\][\u] [ \w ] \[\033[0m\] \n # " # red with default black output (2-tier) # PS1="\[\033[0;33m\][\!]\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u.\h: \`if [[ `pwd|wc -c|tr -d " "` > 18 ]]; then echo "\\W"; else echo "\\w"; fi\`]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007" # yellow and green with default black output # PS1="\[\033[0;33m\][\!]\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u.\h: \`if [[ `pwd|wc -c|tr -d " "` > 18 ]]; then echo "\\W"; else echo "\\w"; fi\`]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007" # yellow, green, w/black output w/color change upon bad command # PS1="\[\033[0;34m\][\u] \[\033[0;0m\]\w \[\033[0m\]$ " # blue username and default black output # PS1="\[\033[0;34m\][\u] \[\033[0;31m\][ \w ] \[\033[0m\] \n >> " # blue and red with default black output (2-tier) # PS1="\[\033[0;34m\][\u] \[\033[0;33m\][ \t ] \[\033[0;31m\][ \w ] \[\033[0m\] \n >> " # blue, yellow, red with default black output (2-tier) # PS1="[\[\033[1;34m\]\u\[\033[0m\]@\h \W]\\$ " # blue username with default colors (black) # PS1="[\[\033[32m\]\w]\[\033[0m\]\n\[\033[1;36m\]\u\[\033[1;33m\]-> \[\033[0m\]" # black, green, cyan, yellow, w/black output w/full path (2-tier) # PS1="\[\033[34m\] \u@\h `tty | sed 's/\/dev\///'` \t \d \[\033[35m\]\w/ \n\[\033[34m\] $\[\033[0m\] " # cyan with green output # PS1="\[\033[35m\]\t\[\033[m\]-\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ " # purple, cyan, black, green, yellow, w/black output # PS1="\[\033[36m\] \u@\h `tty | sed 's/\/dev\///'` \t \d \[\033[32m\]\w/ \n\[\033[36m\] $\[\033[0m\] " # blue with purple output # PS1=">\[\033[s\]\[\033[1;\$((COLUMNS-4))f\]\$(date +%H:%M)\[\033[u\]" # trimmed up prompt with clock using default colors (black) # PS1='C:${PWD//\//\\\}>' # change prompt to MS-DOS one (joke) # PS1='\[\e[0;31m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[0;31m\]\$ \[\e[m\]\[\e[0;32m\]' # red and blue prompt with green output # PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] \[\e[1;37m\]' # green and blue prompt with light grey output # PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\]' # green and blue prompt with default black output # PS1='\e[1;31;47m\u \e[1;32;47mon \h \e[1;35;47m\d \@\e[0;0m\n\e[1;31m[dir.= \w] \# > \e[0;0m' # red, green, purple, red with default black output # PS1='\[\e[1;31m\][\[\e[0;37m\]\u\[\e[1;31m\]@\[\e[0;37m\]\h \W\[\e[1;31m\]]\$\[\e[0m\] ' # red and grey with default black output # PS1='\[\e[1;31m\][\u@\h \W]\$\[\e[0m\] ' # red color with default black output # PS1='\[\e[1;32m\]\u@\H:\[\e[m\] \[\e[1;37m\]\w\[\e[m\]\n\[\e[1;33m\]hist:\! \[\e[0;33m\] \[\e[1;31m\]jobs:\j \$\[\e[m\] ' # green, yellow, red, grey and default black output (2-tier) # PS1='\[\e[1;32m\]\u@\H:\[\e[m\] \[\e[1;37m\]\w\[\e[m\]\n\[\e[1;33m\]hist:\! \[\e[0;33m\] \[\e[1;31m\]jobs:\j \$\[\e[m\] ' # green, yellow, red, w/black output (2-tier) w/background job count # PS1='\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] ' # green color with default black output # PS1='\e[1;33;47m\u \e[1;32;47mon \h \e[1;35;47m\d \@\e[0;0m\n\e[1;34m[dir.= \w] \# > \e[0;0m' # yellow, green, purple, cyan with default black output # PS1="\[\e[1;33m\] > \[\033[0m\]" # basic yellow with default black output & nothing else # PS1='\[\e[1m\]\h:\w\$\[\e[0m\] ' # black-bold with default colors (black) # PS1="\[\e]2;\u@\H \w\a\e[30;1m\]>\[\e[0m\] " # trimmed up prompt w/black arrow & title is current dir. # PS1="\[\e[30;1m\]\w> \[\e[0m\]" # trimmed up prompt with just black arrow and default colors # PS1="\[\e[36;1m\]\u@\[\e[32;1m\]\H> \[\e[0m\]" # cyan and green prompt with default black output # PS1='\[\e[m\n\e[0;33m\][$$:$PPID \j:\!\[\e[0;33m\]]\[\e[0;36m\] \T \d \[\e[1;34m\][\[\e[1;34m\]\u@\H\[\e[1;31m\]:\[\e[0;37m\]${SSH_TTY} \[\e[0;32m\]+${SHLVL}\[\e[1;30m\]] \[\e[1;31m\]\w\[\e[0;30m\] \n($SHLVL:\!)\$ ' # yellow, cyan, red, blue, white, green, black, red w/ default black output # PS1="\`if [ \$? = 0 ]; then echo \[\e[33m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi\`[\u@\h:\w]\\$ " # all black with happy face (yellow/red) upon successful completion # PS1="\`if [ \$? = 0 ]; then echo \[\e[33m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi\`[\u@\h:\w]\\$ " # basic prompt but with yellow smiley # PS1="\n\[\033[32;1m\]It's \t\[\033[33;1m\] Currently browsing \[\033[1;36m\]\w \[\033[33;1m\]directory\n\[\033[34;1m\]\`if [ \$? = 0 ]; then echo \[\e[37m\]Last Command Was Successfully Executed \[\e[32m\]^_^\[\e[0m\]; else echo \[\e[37m\]Smeggin Hell !!! Last Command Was Unknown \[\e[32m\]O_O\[\e[0m\]; fi\` \n\[\033[31m\]What is thy bidding, my master? \n\n\[\033[34;1m\]" # green, yellow, grey, green, red, w/cyan output (3-tier) Star Wars version # PS1="\n\[\033[35m\]\$(/bin/date)\n\[\033[32m\]\w\n\[\033[1;31m\]\u@\h: \[\033[1;34m\]\$(/usr/bin/tty | /bin/sed -e 's:/dev/::'): \[\033[1;36m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files \[\033[1;33m\]\$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\033[0m\] -> \[\033[0m\]" - purple, green, blue, cyan, yellow, with default black output (3-tier) # PS1="\n\[\033[35m\]\$(/bin/date)\n\[\033[32m\]\w\n\[\033[1;31m\]\u@\h: \[\033[1;34m\]\$(/usr/bin/tty | /bin/sed -e 's:/dev/::'): \[\033[1;36m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files \[\033[1;33m\]\$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\033[0m\] -> \[\033[0m\]" # purple, red, blue, cyan, yellow, w/white output (3-tier) # PS1="\n\[$bldgrn\][\[$txtrst\]\w\[$bldgrn\]]\[$bldwht\]\n\[$bldwht\][\[$txtrst\]\t\[$bldwht\]]\[$bldylw\]$ \[$txtrst\]" # green, black, grey, yellow with default black output (3-tier) # PS1="\n#--[\[\e[1;36m\]\u@\h\[\e[m\]]-[\[\e[1;34m\]\w\[\e[m\]]-[\$(date +%k:%M)]-->\n" # black, cyan, blue, black, w/black output (2-tier) # PS1="\n\[\e[30;1m\]\[\016\]l\[\017\](\[\e[34;1m\]\u@\h\[\e[30;1m\])-(\[\e[34;1m\]\j\[\e[30;1m\])-(\[\e[34;1m\]\@ \d\[\e[30;1m\])->\[\e[30;1m\]\n\[\016\]m\[\017\]-(\[\[\e[32;1m\]\w\[\e[30;1m\])-(\[\e[32;1m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, \$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[30;1m\])--> \[\e[0m\]" # grey, cyan, green, w/black output (2-tier) w/ dir. info # PS1="\n\[\e[30;1m\]?(\[\e[34;1m\]\u@\h\[\e[30;1m\])-(\[\e[34;1m\]\j\[\e[30;1m\])-(\[\e[34;1m\]\@ \d\[\e[30;1m\])->\[\e[30;1m\]\n??(\[\e[32;1m\]\w\[\e[30;1m\])-(\[\e[32;1m\]$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, $(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[30;1m\])--> \[\e[0m\]" # black, cyan, green w/black output (2-tier) # PS1="\n\[\e[32;1m\](\[\e[37;1m\]\u\[\e[32;1m\])-(\[\e[37;1m\]jobs:\j\[\e[32;1m\])-(\[\e[37;1m\]\w\[\e[32;1m\])\n(\[\[\e[37;1m\]! \!\[\e[32;1m\])-> \[\e[0m\]" # grey and green with default black output (3-tier) # PS1="\n\[\e[m\][\[\033[01;32m\]\w\[\e[m\]] [\t] \n\[\033[01;33m\]$ \[\033[00m\]" # green, black, yellow, with default black output (3-tier) # PS1="\t \u@\h\$ " # simple prompt with time (black) # PS1="\t \u@\h `tty | sed 's/\/dev\///'` \w \$ " # longer prompt with time (black) # PS1="\u@\h\$ " # simple default prompt (black) # PS1="\u@\h `tty | sed 's/\/dev\///'` \w \$ " # longer prompt with brief info (black) # PS1='[\u@\h \W]\$ ' # default colors (black) # PS1="\u@\h [\w] \$ " # simple prompt with directory (black) # PS1="\u `tty | sed 's/\/dev\///'` [\W] \$ " # prompt with brief info (black) ################################################## # More PROMPT_COMMANDS # ################################################## ###### Annoying PROMPT_COMMAND animation # PROMPT_COMMAND='seq $COLUMNS | xargs -IX printf "%Xs\r" @' ###### Saves terminal commands in history file in real time (for use with 'shopt -s histappend') # PROMPT_COMMAND="history -a;$PROMPT_COMMAND" # use with 'shopt -s histappend';save terminal commands in history file in real time ###### Share history between using multiple commands (press enter before get history from other bash shells) # PROMPT_COMMAND='history -a && history -n' ###### Shows date # PROMPT_COMMAND='date +%k:%m:%S' ###### Shows memory, load average, and history # PROMPT_COMMAND='history -a;echo -en "\033[m\033[38;5;2m"$(( `sed -nu "s/MemFree:[\t ]\+\([0-9]\+\) kB/\1/p" /proc/meminfo`/1024))"\033[38;5;22m/"$((`sed -nu "s/MemTotal:[\t ]\+\([0-9]\+\) kB/\1/Ip" /proc/meminfo`/1024 ))MB"\t\033[m\033[38;5;55m$(< /proc/loadavg)\033[m"' ###### Shows the return value of the last executed command (using smileys as to whether it was successful or not) # PROMPT_COMMAND='RET=$?; if [[ $RET -eq 0 ]]; then echo -ne "\033[0;32m$RET\033[0m ;)"; else echo -ne "\033[0;31m$RET\033[0m ;("; fi; echo -n " "' # Permisos por defecto al crear un archivo o carpeta # umask 022 # You may uncomment the following lines if you want `ls' to be colorized: export LS_OPTIONS='--color=auto' eval "`dircolors`" alias ls='ls $LS_OPTIONS --group-directories-first' alias ll='ls $LS_OPTIONS -l --group-directories-first' alias l='ls $LS_OPTIONS -la --group-directories-first' # # Some more alias to avoid making mistakes: alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' Nota 1.- Se podria hacer que esta modificación afecte a todos los usuarios pero para usuarios noveles recomiendo hacerlo usuario por usuario, pues si se mete la pata siempre habra otro usuario para recuperar el error Fuente: http://gnome-look.org/content/show.p...content=129746 http://www.cyberciti.biz/tips/howto-...up-prompt.html |
01-jul-2012 | #2 |
Ayudante Frecuente Ingreso: junio-2011
Mensajes: 488
Sexo: País: Signo:
Agradecido: +1.238
|
0.o, algún dia entenderé todo eso, soy neófito xD
Gracias por la info "Hay una fuerza motriz más poderosa que el vapor, la electricidad y la energía atómica: la voluntad." Albert Einstein
|
01-jul-2012 | #3 | ||
Ayudante Frecuente Ingreso: mayo-2009
Ubicación: lejos o quiza muy cerca
Mensajes: 295
Sexo: País: Signo:
Agradecido: +836
|
gracias
agrego para el bash http://www.nanolx.org/newsnanolx/bashstyle-ng o para zsh https://github.com/robbyrussell/oh-my-zsh/
y si, cuanto mas cosas le ponemos mas lento carga y mas posibilidades de falla, por lo menos un user (root) sin modificadores o los minimos posibles o varios yo por lo menos uso las dos anteriores y sh, aunque prefiero mas el zsh http://es.wikipedia.org/wiki/Shell_de_UNIX |
||
01-jul-2012 | #4 |
Erudito Ingreso: enero-2012
Ubicación: Barcelona (España)
Mensajes: 5.106
Sexo: País: Signo:
Agradecido: +10.221
|
Buenos aportes Arqtico y Alambre, gracias a los dos.
Mi Sabiduria, abarca lo que una gota de Agua, en el Oceano del Conocimiento |
Usuarios que han agradecido este mensaje de Tururojo | ||
Alambre (02-jul-2012) |
(0 miembros y 1 visitantes) | |
Herramientas | |
Desplegado | |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
Hirens Boot 15.1 | iaboxa | Software | 20 | 06-sep-2017 19:29 |
Porque Linux y no Windows | baduser | Linux | 30 | 14-oct-2013 10:54 |
Instalar Linux en una memoria Flash | cejd | Unix & Linux | 5 | 08-mar-2012 13:54 |
Aspectos básicos de GNU/Linux e instalación de Ubuntu | fireligena | Linux | 9 | 14-nov-2010 13:38 |