LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How Does Your Shell Prompt Looks Like? (https://www.linuxquestions.org/questions/linux-general-1/how-does-your-shell-prompt-looks-like-866012/)

devUnix 03-02-2011 11:50 AM

How Does Your Shell Prompt Looks Like?
 
How Does Your Shell Prompt Look Like? And How Do You Make It?

Reveal the output of this command executed on your Unix / Linux Box:

Code:

echo $PS1
Unimportant Note: How do we edit / modify our subject line / heading on this forum once we have saved it? There is a typo "Looks" in the heading and I do not seem to see a way to edit it.

stress_junkie 03-02-2011 12:00 PM

Well if you must know my shell prompt looks like this:
Quote:

C:\Users\HP_Administrator>
I didn't do anything to create this. It's the system default when I run the terminal as follows:

Start -> Accessories -> Run -> cmd.exe

I think that's the Ubuntu default terminal emulator but I'm not certain.

szboardstretcher 03-02-2011 12:22 PM

Code:

(terminal@msdos)-(01:22 PM Wed Mar 02)-(~)
$ >

Unlike stress_junkie, who likes to use the default "Ubuntu" shell prompt :D, I do mine like this, because I like to know *exactly* what directory I am in, what user I am, and what box I am logged into. This way I won't ever have to say "Oh, sorry, I deleted that file, I thought I was on a development box."

Here is the prompt if you'd like to use it -- its colorized. Blue currently. I've used red and green versions for Dev / Prod, accordingly.

Code:

PS1='\[\033[1;31m\]\[\033[1;30m\](\[\033[1;34m\]\u\[\033[1;37m\]@\[\033[0;37m\]\h\[\033[1;30m\])-(\[\033[0;37m\]\@\[\033[0;32m\] \[\033[1;34m\]\d\[\033[1;30m\])-(\[\033[1;32m\]\w\[\033[1;30m\])\[\033[0;34m\]\n\[\033[1;34m\]\$ \[\033[1;37m\]>\[\033[0;37m\]'

export PS1


devUnix 03-02-2011 12:55 PM

Quote:

Originally Posted by stress_junkie (Post 4276604)
Well if you must know my shell prompt looks like this:


I didn't do anything to create this. It's the system default when I run the terminal as follows:

Start -> Accessories -> Run -> cmd.exe

I think that's the Ubuntu default terminal emulator but I'm not certain.

Oh! :rolleyes: I never knew Ubuntu would imitate DOS stuffs!

devUnix 03-02-2011 12:59 PM

Quote:

Originally Posted by szboardstretcher (Post 4276632)
Unlike stress_junkie, who likes to use the default "Ubuntu" shell prompt :D

Well, I really appreciate "humour" which you people have shown.

szboardstretcher 03-02-2011 01:03 PM

Quote:

Originally Posted by devUnix (Post 4276674)
Well, I really appreciate "humour" which you people have shown.

I also included my shell prompt,.. which I think is pretty original. I've been using it for nearly a decade. I actually toyed around with the idea of starting a "shell skinning" website, where I would offer different looking shell prompts with different colors.

never got around to doing that though.

devUnix 03-02-2011 01:11 PM

Quote:

Originally Posted by szboardstretcher (Post 4276678)
I also included my shell prompt,.. which I think is pretty original.

Yes, I have checked it out! Mine looks like this now:

Code:

(root@host-6-33)-(07:49 PM Wed Mar 02)-(~)
# >

Prettier than it looks above. ;)

unSpawn 03-02-2011 01:14 PM

Quote:

Originally Posted by szboardstretcher (Post 4276678)
I actually toyed around with the idea of starting a "shell skinning" website, where I would offer different looking shell prompts with different colors. never got around to doing that though.

You mean like http://dotfiles.org/.bashrc ?

devUnix 03-02-2011 01:29 PM

Quote:

Originally Posted by unSpawn (Post 4276690)

That is great!

I have seen some dotfiles on this website and found them very interesting and useful!

http://dotfiles.org/

colucix 03-02-2011 01:38 PM

Mine is something like this (cannot reproduce the exact colors):
Code:

┌─[colucix@linux]-[Working Directory]
└─•


devUnix 03-02-2011 01:47 PM

Quote:

Originally Posted by colucix (Post 4276714)
Mine is something like this (cannot reproduce the exact colors):
Code:

┌─[colucix@linux]-[Working Directory]
└─•


Clever!

I have tried to do that:

Code:

-[root@host-6-33]-[~]
|
-*

You have not shared the output of your:

Code:

echo $PS1

colucix 03-02-2011 01:51 PM

He he... it uses Unicode characters! :) Here is an excerpt from my .bashrc:
Code:

#
#    ┌─  is  u250C + u2500
#    └─  is  u2514 + u2500
#    •    is  u26AB
#    ▪    is  u25AA
#    ▸    is  u25B8
#
G='\033[0;30m' # black
N='\033[0;32m' # green
C='\033[0;36m' # cyan
R='\033[0;31m' # red
W='\033[0m'    # default
export PS1="\[$G\]┌─[\[$N\]\u\[$G\]@\[$C\]linux\[$G\]]-[\[$R\]\W\[$G\]]\n└─• \[$W\]"


devUnix 03-02-2011 02:00 PM

That is interesting!

But how do we type in this strange symbol in vim?

"\[$G\]┌─[\[$N\]

szboardstretcher 03-02-2011 02:01 PM

Quote:

Originally Posted by colucix (Post 4276714)
Mine is something like this (cannot reproduce the exact colors):
Code:

┌─[colucix@linux]-[Working Directory]
└─•


Very cool. Nice unicodes.

colucix 03-02-2011 02:05 PM

Quote:

Originally Posted by devUnix (Post 4276758)
That is interesting!

But how do we type in this strange symbol in vim?

"\[$G\]┌─[\[$N\]

In vim I don't know. In terminals with support for Unicode you press CTRL-SHFT-U followed by the unicode number + Enter. It works even in the quick reply box here at LQ.

phil.d.g 03-02-2011 11:39 PM

Code:

conroe $ echo $PS1
\[\e[32m\]\h \[\e[0m\]\$

Nice and simple!


All times are GMT -5. The time now is 10:55 PM.