| Line 2: |
Line 2: |
| | echo $PS1 | | echo $PS1 |
| | | | |
| − | * \u --> Username | + | *\u --> Username |
| − | * \h --> Hostname | + | *\h --> Hostname |
| − | * \w --> Current working Directory | + | *\w --> Current working Directory |
| − | * More info @man page bash | + | *More info @man page bash |
| | | | |
| | To modify edit ~/.bashrc | | To modify edit ~/.bashrc |
| Line 12: |
Line 12: |
| | Test color and style with: | | Test color and style with: |
| | echo -e "\033[04;91;46m something \033[00m" | | echo -e "\033[04;91;46m something \033[00m" |
| − | * 04 --> underline (01 bold) | + | |
| − | * 91 --> ligth red foreground | + | *04 --> underline (01 bold) |
| − | * 46 --> cyan background | + | *91 --> ligth red foreground |
| | + | *46 --> cyan background |
| | | | |
| | http://ezprompt.net<br /> | | http://ezprompt.net<br /> |
| | https://wiki.archlinux.org/index.php/Bash/Prompt_customization#Colors<br /> | | https://wiki.archlinux.org/index.php/Bash/Prompt_customization#Colors<br /> |
| | | | |
| − | == Examples== | + | ==Examples== |
| − | === Kali === | + | ===Kali=== |
| | <source lang="bash">PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '</source> | | <source lang="bash">PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '</source> |
| | <source lang="bash">PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "</source> | | <source lang="bash">PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "</source> |
| − | === Ubuntu === | + | ===Ubuntu=== |
| | <source lang="bash">PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '</source> | | <source lang="bash">PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '</source> |
| − | === Example === | + | ===Example=== |
| | <source lang="bash">PS1="\[\e[31m\][\[\e[m\]\[\e[31m\]\u\[\e[m\]@\[\e[31m\]\h\[\e[m\]\[\e[31m\]]\[\e[m\]:\[\e[36m\][\[\e[m\]\[\e[36m\]\w\[\e[m\]\[\e[36m\]]\[\e[m\]\[\e[31m\]\\$\[\e[m\] " | | <source lang="bash">PS1="\[\e[31m\][\[\e[m\]\[\e[31m\]\u\[\e[m\]@\[\e[31m\]\h\[\e[m\]\[\e[31m\]]\[\e[m\]:\[\e[36m\][\[\e[m\]\[\e[36m\]\w\[\e[m\]\[\e[36m\]]\[\e[m\]\[\e[31m\]\\$\[\e[m\] " |
| | export PS1="\[\e[33m\]\u\[\e[m\]@\[\e[31m\]\h\[\e[m\]:[\W]\\$ "</source> | | export PS1="\[\e[33m\]\u\[\e[m\]@\[\e[31m\]\h\[\e[m\]:[\W]\\$ "</source> |
| | | | |
| − | === New line before, red username yellow@ green host:[blue path]$ === | + | ===New line before, red username yellow@ green host:[blue path]$=== |
| | <source lang="bash">PS1="\n\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\][\w]\[\033[00m\]\$ "</source> | | <source lang="bash">PS1="\n\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\][\w]\[\033[00m\]\$ "</source> |
| | | | |
| − | === red username yellow@ green host:[blue path]$ === | + | ===red username yellow@ green host:[blue path]$=== |
| | <source lang="bash">PS1="\[\e]0;\u@\h: \w\a\]\n\[\e]0;\u@\h: \w\a\]\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\][\w]\[\033[00m\]$ "</source> | | <source lang="bash">PS1="\[\e]0;\u@\h: \w\a\]\n\[\e]0;\u@\h: \w\a\]\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\][\w]\[\033[00m\]$ "</source> |
| | | | |
| − | === Red username yellow @ purple hostname blue path === | + | ===Red username yellow @ purple hostname blue path=== |
| | <source lang="bash">PS1="\[\e]0;\u@\h: \w\a\]\[\e]0;\u@\h: \w\a\]\[\033[01;31m\]\n\u\[\033[01;33m\]@\[\033[01;35m\]\h\[\033[00m\]:\[\033[01;34m\][\w]\[\033[00m\]$ "</source> | | <source lang="bash">PS1="\[\e]0;\u@\h: \w\a\]\[\e]0;\u@\h: \w\a\]\[\033[01;31m\]\n\u\[\033[01;33m\]@\[\033[01;35m\]\h\[\033[00m\]:\[\033[01;34m\][\w]\[\033[00m\]$ "</source> |
| | | | |
| − | === New Line, red username, yellow @, red foreground and cyan background hostname, blue path === | + | ===New Line, red username, yellow @, red foreground and cyan background hostname, blue path=== |
| | <source lang="bash">PS1="\[\e]0;\u@\h: \w\a\]\[\e]0;\u@\h: \w\a\]\[\033[01;31m\]\n\u\[\033[01;33m\]@\[\033[04;91;46m\]\h\[\033[00m\]:\[\033[01;34m\][\w]\[\033[00m\]$ "</source> | | <source lang="bash">PS1="\[\e]0;\u@\h: \w\a\]\[\e]0;\u@\h: \w\a\]\[\033[01;31m\]\n\u\[\033[01;33m\]@\[\033[04;91;46m\]\h\[\033[00m\]:\[\033[01;34m\][\w]\[\033[00m\]$ "</source> |
| | | | |
| − | === New Line, red username, yellow @, red foreground and cyan background hostname, blue path === | + | ===New Line, red username, yellow @, red foreground and cyan background hostname, blue path=== |
| | <source lang="bash">PS1="\[\e]0;\u@\h: \w\a\]\[\e]0;\u@\h: \w\a\]\[\033[01;32m\]\n\u\[\033[01;33m\]@\[\033[04;91;46m\]\h\[\033[00m\]:\[\033[01;34m\][\w]\[\033[00m\]$ "</source> | | <source lang="bash">PS1="\[\e]0;\u@\h: \w\a\]\[\e]0;\u@\h: \w\a\]\[\033[01;32m\]\n\u\[\033[01;33m\]@\[\033[04;91;46m\]\h\[\033[00m\]:\[\033[01;34m\][\w]\[\033[00m\]$ "</source> |
| | | | |
| − | === With flag === | + | ===With flag=== |
| | <source lang="bash">PS1=$'\\[\e[31m\\]\u2234\\[\e[0m\\]\n \\[\e[31m\\]\u2588\\[\e[33m\\]\u2588\\[\e[31m\\]\u2588 ${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;31m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ \\[\e[0m\\] '</source> | | <source lang="bash">PS1=$'\\[\e[31m\\]\u2234\\[\e[0m\\]\n \\[\e[31m\\]\u2588\\[\e[33m\\]\u2588\\[\e[31m\\]\u2588 ${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;31m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ \\[\e[0m\\] '</source> |
| | | | |
| | <source lang="bash">PS1=$'\\[\e[31m\\]\u2234\\[\e[0m\\]\n\\[\e[31m\\]\u2588\u2588\u2588\n\\[\e[33m\\]\u2588\u2588\u2588\n\\[\e[31m\\]\u2588\u2588\u2588 ${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;31m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ \\[\e[0m\\]'</source> | | <source lang="bash">PS1=$'\\[\e[31m\\]\u2234\\[\e[0m\\]\n\\[\e[31m\\]\u2588\u2588\u2588\n\\[\e[33m\\]\u2588\u2588\u2588\n\\[\e[31m\\]\u2588\u2588\u2588 ${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;31m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ \\[\e[0m\\]'</source> |
| | | | |
| − | === With git branch and timestamp === | + | ===With git branch and timestamp=== |
| | <source lang="bash">git_branch () { | | <source lang="bash">git_branch () { |
| | git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | | git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' |
| Line 57: |
Line 58: |
| | <source lang="bash">PS1='\[\033[01;31m\]\t $(git_branch)\n\[\033[01;32m\]\u@\[\033[02;36m\]\h\[\033[01;34m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '</source> | | <source lang="bash">PS1='\[\033[01;31m\]\t $(git_branch)\n\[\033[01;32m\]\u@\[\033[02;36m\]\h\[\033[01;34m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '</source> |
| | | | |
| − | == Green prompt with timestamp == | + | ==Green prompt with timestamp== |
| | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\D{%F %T}\n\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\D{%F %T}\n\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' |
| − | == Green prompt with white timestamp == | + | ==Green prompt with white timestamp== |
| | PS1='${debian_chroot:+($debian_chroot)}\n\[\033[00m\]\D{%F %T}\n\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | | PS1='${debian_chroot:+($debian_chroot)}\n\[\033[00m\]\D{%F %T}\n\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' |
| | | | |
| Line 66: |
Line 67: |
| | | | |
| | Another example: | | Another example: |
| − | <source lang="bash">function elite
| + | <source lang="bash">function elite |
| | { | | { |
| | | | |