PS1

All posts tagged PS1

Create a PS1 variable in /etc/profile or /etc/bash.bashrc files with: export PS1='[\[\033[01;36m\]\u\[\033[01;33m\]@\[\033[01;32m\]\h\[\033[00m\]:\[\033[1;37m\]\w\[\033[00m\]]\$ ‘   Below you can find the color definition: Black 0;30 Dark Gray 1;30 Blue 0;34 Light Blue 1;34 Green 0;32 Light Green 1;32 Cyan 0;36 Light Cyan 1;36 Red 0;31 Light Red 1;31 Purple 0;35 Light Purple 1;35 Brown 0;33 Yellow 1;33 Light Gray 0;37 White 1;37   To help myself remember what colours are Read more...
Special characters to show useful information in $PS1 prompt: \h short hostname (without domain). \H long hostname. \n new line. \s shell name (like bash, sh) \t 24h format clock. \u current username. \v shell version. \w current folder. Inside PS1 we can add the output of a specific command, preferably with short output, like  PS1=$(date) We can color the prompt messages just adding  \[\033[COLORm\]. and \[\033[0m\] to stop colors to avoid colored commands. Where COLOR Read more...