General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
12-25-2006, 04:22 AM
|
#1
|
Member
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700
Rep:
|
Post your BASH prompt [PS1]?
Post your PS1 variable (for both normal/root user if they differ)! (add a screenshot too if you wish)
[I hope this doesn't turn out to be a dup thread. I performed a search and it didn't seem like there was a similar existing thread]
So anyway, here are mine (quite basic
Code:
Normal user:
PS1="\[\033[1;30m\][\[\033[1;33m\]\w\[\033[1;30m\]]\[\033[0m\] "
Code:
Root user:
PS1="\[\033[1;30m\][\[\033[1;31m\]\w\[\033[1;30m\]]\[\033[0m\] "
Screen shot: http://img221.imageshack.us/img221/7968/ps1yh1.png
Just realised this forum has color caps This is what it looks like:
Code:
[~] echo "This is what it looks like for a normal user!"
This is what it looks like for a normal user!
[~]
Code:
[~] echo "This is what it looks like for root!"
This is what it looks like for root!
[~]
Well.. imagine it on a dark background :-) Or check out the screen shot.
|
|
|
12-25-2006, 04:44 AM
|
#2
|
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464
Rep:
|
Mine's just quite boring: \u@\h:\w\$
|
|
|
12-25-2006, 07:30 AM
|
#3
|
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908
|
# PS1 for root and user shell prompt
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
|
|
|
12-26-2006, 11:12 AM
|
#4
|
Member
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 683
Rep:
|
Quote:
Originally Posted by Nylex
Mine's just quite boring: \u@\h:\w\$
|
almost the same as mine...
PS1="\u@\h \w -->"
I prefer to think of it as efficient.
|
|
|
12-26-2006, 11:18 AM
|
#5
|
Senior Member
Registered: Oct 2004
Posts: 1,272
Rep:
|
I don't like mine taking up too much space on the line:
|
|
|
12-26-2006, 11:37 AM
|
#6
|
Member
Registered: Apr 2003
Location: Juneau, Alaska
Posts: 251
Rep:
|
Mine inserts a blank line above the prompt. It just seems to make it easier to spot.
[tom@compac ~]$ echo $PS1
\n[\u@\h \W]\$
|
|
|
12-26-2006, 05:43 PM
|
#7
|
Member
Registered: Jun 2005
Location: University of Maryland
Distribution: FreeBSD
Posts: 268
Rep:
|
Code:
[17:42:18] ~ : echo $PS1
\[\033[0;34m\][\t] \w : \[\033[0m\]
looks great with my .Xdefaults
Last edited by Ha1f; 12-26-2006 at 05:45 PM.
|
|
|
12-26-2006, 06:53 PM
|
#8
|
Member
Registered: Sep 2004
Location: India
Distribution: Kubuntu, Archlinux, Suse, Gentoo, Mandrake
Posts: 371
Rep:
|
[advertisement] Hey guys, have you heard of ZSH? [/advertisement]
Sorry couldn't resist. Here is my screenshot
http://img510.imageshack.us/my.php?i...apshot1qi8.png
For the skeptical, zsh is almost exactly like bash, just with a lot more features and functionalities.
Last edited by anupamsr; 12-26-2006 at 06:55 PM.
|
|
|
12-26-2006, 08:00 PM
|
#9
|
Senior Member
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450
Rep:
|
I use tcsh on most of my systems for interactive use. So I don't have a PS1.
But my $prompt usually looks like this:
Code:
"%{\033[34m%}[%{\033[39m%}%B%m%b%{\033[34m%}] %B%~%b%#%{\033[0m%} "
Or without color (as it's easier to make sense of what I'm doing without color codes there):
Code:
"[%B%m%b] %B%~%b%# "
In practice it looks like:
This is of the form "[ hostname] current_directory{%,#} " and is pretty much the standard for how I like to see things. I need to have hostnames in my prompt because I often have windows to several machines open at the same time and switching to the wrong one is a pain.
Note: My prompt does change at times (although currently only once per day). If I am logged in at 4pm it becomes the following until I either change it or it changes again:
Code:
Have you had tea today? [fnord] /tmp%
I actually try and setup prompt reminders if I know I'm going to be working for a while and might lose track of time. Everything from "STOP WORKING $stdprompt" to more obscene reminders.
Last edited by frob23; 12-26-2006 at 08:01 PM.
|
|
|
12-27-2006, 11:08 AM
|
#10
|
Member
Registered: Sep 2004
Location: India
Distribution: Kubuntu, Archlinux, Suse, Gentoo, Mandrake
Posts: 371
Rep:
|
Here is my prompt info:
Code:
export PROMPT=$'%(?..%{\e[41;38m%}%B-%?-%b%{\e[0m%} )%(1j.%{\e[01;33m%}[%j] .)%{\e[01;32m%}%n@%m%{\e[0m%} %{\e[01;36m%}%2~%{\e[0m%} %B%#%b '
export RPROMPT=$'%{\e[01;31m%}[%T]%{\e[0m%}'
It basically looks like:
http://img167.imageshack.us/my.php?i...apshot1oe3.png
(previous screenshot was useless)
The right prompt gives the time you enter any command. It is IMHO the best way to know time
In the left prompt, error values returned by previous commands are in red, and number of commands running in background are in yellow. Only last two directories are shown to save space in terminal.
My bashrc is pretty standard of Gentoo:
Code:
export PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \W \$\[\033[00m\] "
|
|
|
12-27-2006, 11:32 AM
|
#11
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
And mine:
Root: PS1='\[\033[31m\][`uname -n`] root \[\033[0m\]\w $ '
[inferno] root ~ $
User: PS1='\[\033[34m\][`uname -n`] \u \[\033[0m\]\w $ '
[stasis] druuna /tmp $
As is probably true for most of the above, the most important info (for me, ofcourse) is given.
|
|
|
12-27-2006, 04:47 PM
|
#12
|
Member
Registered: Mar 2005
Location: Winnipeg, MB
Distribution: Raspbian, Debian, Slackware, OS X
Posts: 443
Rep:
|
Mine is pretty simple:
Code:
[truthfatal@neverwinter:~]$ echo $PS1
[\u@\h:\W]\$
After this thread I think I may look at the options for using different colours though
...edit with colour (it was easier than I thought.)
[truthfatal@neverwinter: ~]$ echo $PS1
\[\033[34m\][\[\033[0m\]\u@\h:\[\033[31m\]\W\[\033[34m\]]\[\033[0m\]\$
Last edited by truthfatal; 12-27-2006 at 04:54 PM.
|
|
|
All times are GMT -5. The time now is 04:37 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|