Last active
January 4, 2023 22:44
-
-
Save skarllot/2648493 to your computer and use it in GitHub Desktop.
Default Bash prompt (bashrc PS1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Each distribution default Bash prompts | |
# Gentoo (/etc/bash/bashrc) | |
if [[ ${EUID} == 0 ]] ; then | |
PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] ' | |
else | |
PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' | |
fi | |
# CentOS or Fedora (/etc/bashrc) | |
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " | |
# Debian (/etc/bash.bashrc) | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | |
# References: | |
# https://wiki.archlinux.org/index.php/Color_Bash_Prompt | |
# http://wiki.centos.org/TipsAndTricks/CustomizeBash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Gentoo style, copy to /etc/profile.d/prompt.sh | |
if [[ ${EUID} == 0 ]] ; then | |
PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] ' | |
else | |
PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' | |
fi |
More here.
- MacOS
PS1='\h:\w \u\$ '
- Slackware
PS1='Bash-\v\$ '
- OpenSUSE
PS1='\u@\h:\w> '
- DOS Clone
PS1='C:$(pwd)/>'
- MinGW64 (With git branch)
Code stolen from Chi Thuc Nguyen
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1='\n\[\e[32m\]\h \[\e[35m\]\u \[\e[33m\]\w \[\e[36m\]$(parse_git_branch)\n\[\e[00m\]\$ '
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
void's default PS1