Quite simple... ;)
Code:
mary@linux % ~ |
My prompt?
3 lines long username on host.domain:/home/username cmd-> Done as PS1=" `whoami` on `hostname:\$PWD cmd-> " root's is slightly modified as root on host.domain:/root Simon Says-> |
james@poseidon ~ $
james@poseidon is in green path and $ is in blue For root root@poseidon ~ # root@poseidon in red path and # is in blue Code:
# Define some colors first: |
bigrigdriver Mon Oct 18] $ /path/to/working/directory. Red if I su to root; blue otherwise.
I have this in /etc/bashrc; # bash-specific settings ROOT_UID=0 if [ "$UID" -eq "$ROOT_UID" ] then PS1="\[\033[31;1m\]\u \d] \\$\w\n \[\033[0m\]" else PS1="\[\033[34;1m\]\u \d] \\$\w\n \[\033[0m\]" fi |
How do I get my prompt to show instead of ${PWD}, just the last 3 levels of the path ?
|
7h15 15 ]V[1]\[3
:: fugu@oni-tng /etc :: Code:
PS1="\[\033[1;30m\]:\[\033[1;33m\]: \[\033[1;30m\]\u@\h \[\033[1;33m\]\w \[\033[1;33m\]:\[\033[1;30m\]: |
for regular user:
[Mon Nov 1][user@percentageness] [~/music]$ for root: [Mon Nov 1][root@percentageness] [/etc][YOU ARE ROOT]# for regular users: PS1="[\d][\u@percentageness]\n[\w]\$ " for root PS1="[\d][\u@percentageness]\n[\w][YOU ARE ROOT]\# " |
Quote:
Code:
|
My home prompt is pretty complex:
Code:
\[\033[0;34m\][\[\033[0;35m\]\u\[\033[0;34m\]@\[\033[0;35m\]\h\[\033[0;34m\]]\[\033[1;37m\]:\[\033[0;31m\]\@\[\033[1;37m\]:\[\033[0;31m\]\d\n\[\033[0;34m\][\[\033[0;31m\]\w\[\033[0;34m\]]\[\033[1;37m\]:: [ user@host ] :current time:current date [ pwd ] :: While my work prompt is very simple: Code:
\u@\h:\w\$ |
Quote:
3: `pwd|awk --field-separator='/' {'print $(NF-2)/$(NF-1)/$(NF)'}` # By the way this is not Linux it is HP tru 64 |
echo $PS1
\033[35m\]\nDirectory:\[\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\] --- Ends Up Lookin Like This Directory:~ root@localhost: pts/4: 71 files1.1Gb -> |
After 6 years
Code:
16:52:49 Sat Mar 26 anisha ~ fortune |
for me:
[bread@staircase:~]$ and for root: [root@staircase:~]# .zshrc Code:
PS1="[$PR_WHITE%n$PR_NO_COLOR@$PR_NO_COLOR%m%u$PR_NO_COLOR:$PR_NO_COLOR%2c$PR_NO_COLOR]%(!.#.$) " |
Using zsh:
After a successful command: tobi@dragon ~ :) % After an unsuccessful command: tobi@dragon ~ :( % Code:
PROMPT=$'%n@%m %0(3c,%c,%~) %0(?,%{\e[0;32m%}:%),%{\e[0;31m%}:(%s)%b %# ' |
Mine is simple: nick@vega:~$
|
All times are GMT -5. The time now is 05:29 PM. |