LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 12-25-2006, 04:22 AM   #1
introuble
Member
 
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700

Rep: Reputation: 31
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.
 
Old 12-25-2006, 04:44 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Mine's just quite boring: \u@\h:\w\$
 
Old 12-25-2006, 07:30 AM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
# 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
 
Old 12-26-2006, 11:12 AM   #4
Blinker_Fluid
Member
 
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 683

Rep: Reputation: 63
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.
 
Old 12-26-2006, 11:18 AM   #5
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,272

Rep: Reputation: 154Reputation: 154
I don't like mine taking up too much space on the line:
Code:
$ echo $PS1
\$
 
Old 12-26-2006, 11:37 AM   #6
camelrider
Member
 
Registered: Apr 2003
Location: Juneau, Alaska
Posts: 251

Rep: Reputation: 32
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]\$
 
Old 12-26-2006, 05:43 PM   #7
Ha1f
Member
 
Registered: Jun 2005
Location: University of Maryland
Distribution: FreeBSD
Posts: 268

Rep: Reputation: 30
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.
 
Old 12-26-2006, 06:53 PM   #8
anupamsr
Member
 
Registered: Sep 2004
Location: India
Distribution: Kubuntu, Archlinux, Suse, Gentoo, Mandrake
Posts: 371

Rep: Reputation: 30
[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.
 
Old 12-26-2006, 08:00 PM   #9
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
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:
Code:
[fnord] /tmp%
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.
 
Old 12-27-2006, 11:08 AM   #10
anupamsr
Member
 
Registered: Sep 2004
Location: India
Distribution: Kubuntu, Archlinux, Suse, Gentoo, Mandrake
Posts: 371

Rep: Reputation: 30
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\] "
 
Old 12-27-2006, 11:32 AM   #11
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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.
 
Old 12-27-2006, 04:47 PM   #12
truthfatal
Member
 
Registered: Mar 2005
Location: Winnipeg, MB
Distribution: Raspbian, Debian, Slackware, OS X
Posts: 443
Blog Entries: 9

Rep: Reputation: 32
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PS1 = * in bash, where '*' = parameters BlueSpirit Slackware 5 11-05-2006 09:21 AM
bash PS1 problems Krelian Linux - General 2 10-07-2006 10:16 PM
bash prompt subG Slackware 6 01-18-2006 05:43 PM
$PS1 different in X and prompt codec Slackware 7 06-27-2004 05:42 PM
help with bash prompt everythingand2 Linux - Newbie 7 12-06-2003 05:28 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 04:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration