LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   What does your shell prompt look like? (https://www.linuxquestions.org/questions/linux-general-1/what-does-your-shell-prompt-look-like-115354/)

mary 10-17-2004 08:29 PM

Quite simple... ;)

Code:

mary@linux %                                              ~
I'm using zsh, and I have my mary@linux on the left and my present directory on the right.

amfoster 10-18-2004 07:53 PM

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->

darthtux 10-18-2004 08:02 PM

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:
red='\033[0;31m'
RED='\033[1;31m'
green='\033[0;32m'
GREEN='\033[1;32m'
yellow='\033[0;33m'
YELLOW='\033[1;33m'
blue='\033[0;34m'
BLUE='\033[;1;34m'
purple='\033[0;35m'
PURPLE='\033[1;35m'
cyan='\033[0;36m'
CYAN='\033[1;36m'
white='\033[0;37m'
WHITE='\033[1;37m'
NC='\033[0m'  # No Color

function MyPrompt {

    case $TERM in
        *term* | rxvt )

PS1="$GREEN\u@\h $BLUE\w \$$NC \[\033]0;\u@\h \w\007\]" ;;
                *)
PS1="\u@\h: \w \$ ";;
    esac
}
fi

MyPrompt


bigrigdriver 10-18-2004 11:45 PM

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

davholla 11-01-2004 06:28 AM

How do I get my prompt to show instead of ${PWD}, just the last 3 levels of the path ?

fili 11-01-2004 08:53 AM

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\]:

XsuX 11-01-2004 03:15 PM

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]\# "

david_ross 11-02-2004 01:30 PM

Quote:

Originally posted by davholla
How do I get my prompt to show instead of ${PWD}, just the last 3 levels of the path ?
Try this:
Code:


PS1="Last 3: \`pwd|awk --field-separator='/' {'print \$(NF-2)\"/\"\$(NF-1)\"/\"\$(NF)'}\` # "


cyberliche 11-02-2004 02:46 PM

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\]::
Which looks something like this:
[ user@host ] :current time:current date
[ pwd ] ::

While my work prompt is very simple:

Code:

\u@\h:\w\$

davholla 11-04-2004 05:43 AM

Quote:

Originally posted by david_ross
Try this:
Code:


PS1="Last 3: \`pwd|awk --field-separator='/' {'print \$(NF-2)\"/\"\$(NF-1)\"/\"\$(NF)'}\` # "


Now it looks like :-
3: `pwd|awk --field-separator='/' {'print $(NF-2)/$(NF-1)/$(NF)'}` #

By the way this is not Linux it is HP tru 64

linuxgodrh 01-01-2005 11:23 PM

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 ->



Aquarius_Girl 03-26-2011 11:56 AM

After 6 years
 
Code:

16:52:49 Sat Mar 26 anisha ~  fortune
"I haven't lost my mind; I know exactly where I left it."

PS1="\e[0;36m\t \d \u \w \e[m "

tacticalbread 03-27-2011 01:03 AM

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]%(!.#.$) "
\o/

TobiSGD 03-27-2011 01:28 AM

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 %# '

Nylex 03-27-2011 01:37 AM

Mine is simple: nick@vega:~$


All times are GMT -5. The time now is 05:29 PM.