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

david_ross 11-12-2003 05:00 PM

What does your shell prompt look like?
 
Well we have a thread for screen shots so waht about your shell prompt?

There are lots of examples on the net including ones that show load averages etc so I just wondered what other people used.

I'll start off with my default one:
Code:

rossy - Wed Nov 12 22:57:01
~> cd /usr/src/linux
rossy - Wed Nov 12 22:57:06
/usr/src/linux>

The prompt string is:
PS1="\[\033[0;31m\]\u - \d \t\n\w> \[\033[0m\]"

Please try and include any commands/scripts etc you used to get your prompt.

trickykid 11-12-2003 05:04 PM

Mines simple and probably standard:

Code:

drew@trickykid:/etc$
The prompt string is:
PS1='\u@\h:\w\$ '

Blinker_Fluid 11-12-2003 05:50 PM

Here's my prompt string...
PS1="[\u@\h \w]--> "

shows up like this:
[blinky@Spork ~]-->

slakmagik 11-12-2003 06:28 PM

Code:

|--j@slackmagick bash 2.05b (1) Wed Nov 12 19:26:51
|--~ >>

Code:

PS1='\n|--\u@\h \s \v (\l) \d \t\n|--\w >> '

m0rl0ck 11-12-2003 09:58 PM

[[@bunny:17:54:17:root]]

But you dont get the full effect without the color, try it out:

PS1="\[\033[1;30m\]\[\033[0;32m\][\[\033[1;32m\][\[\033[1;35m\]\[\033[1;36m\]@\h
\[\033[1;37m\]:\[\033[1;35m\]\t\[\033[1;37m\]:\[\033[1;36m\]\W\[\033[1;32m\]]\[\
033[0;32m\]]\[\033[1;30m\]]\[\033[0;0m\]"

Make sure you get the line returns out.

This is my firewall:
[@m0rl0ck:22:57:15:root]+>

Some what the same but uses reverse video, heres the $PS1:

PS1="[\[\033[1;36m\]@\[\033[0;45m\]\h:\[\033[1;36m\]\t\[\033[0;44m\]\[\033[1;36m
\]:\W\[\033[0m\]]\[\033[1;31m\]+>\[\033[0m\]"


EDIT: HEY!! I just realized my clocks are either out of sync or it took me 5 hours 3 mins to compose this post :)

green_dragon37 11-12-2003 10:02 PM

I use ctrl+Z alot, so:

0 [321-2]
[Wed Nov 12 22:02:47]
green_dragon37@grndrgn001 / >

PS1 = \j [\!-\#]\n[\d \t]\n\u@\h \W >

Cerbere 11-13-2003 05:18 AM

For regular users: (I have a rather colorful hostname, so I edited it somewhat for this post)

cerbere@s#|thead:~$
PS1='\u@\h:\w\$ '

For root:

root@s#|thead:~#
PS1='\[\033[1;31m\]\u@\h\[\033[1;33m\]:\w\[\033[0m\]\$ '

This changes the color of 'root@hostname' to bright red, and the color of the pwd to bright yellow. That way I'm less likely to do things as root that I really don't want to do.

Enjoy!
--- Cerbere

yapp 11-13-2003 09:23 AM

It depens on the way I've been logged into the system :-D

normal user: me@pts/1 foldername $

root user: root@pts/1 foldername $

and remotely, me@hal9000 foldername $

The title of the xterm / konsole will also display the tty, host, and full path name. (only the last folder is shown in the prompt)

Code:

#!/bin/bash

PS1='\u@\h:\w\$ '

if [ "$TERM" = "xterm" -o "$TERM" = "xrvt" -o "$TERM" = "$SCREEN" ]; then
  ## Only update the title in an xterm.
  PS1_TITLE='\[\e]2;\u@\H:pts/\l \w\a'
# PS1_TITLE='\[\e]2;\u@\H \w\a\e[32;1m\]>\[\e[0m\]'
else
  PS1_TITLE=''
fi


if [ -z "$SSH_CONNECTION" ]; then

  # local, don't display host, but tty device.

  PS1_TTY="`tty | sed -e 's/\/dev\///'`"

  if [ "`id -u`" = "0" ]; then
    # Red root prompt
    PS1_USER='\[\033[1;31m\]\u'
    PS1_AT='\[\033[0;31m\]@'
    PS1_HOST='\[\033[1;31m\]'
  else
    # Green user prompt
    PS1_USER='\[\033[1;32m\]\u'
    PS1_AT='\[\033[0;32m\]@'
    PS1_HOST='\[\033[1;32m\]'
  fi

  PS1_HOST="$PS1_HOST$PS1_TTY"
  unset -v PS1_TTY

else

  # SSH connection, different color and display host.

  if [ "`id -u`" = "0" ]; then
    # Red/gray root prompt
    PS1_USER='\[\033[1;31m\]\u'
    PS1_AT='\[\033[0;31m\]@'
  else
    # green/gray user prompt
    PS1_USER='\[\033[1;32m\]\u'
    PS1_AT='\[\033[0;32m\]@'
  fi
  PS1_HOST='\[\033[1;30m\]\h'
fi

PS1_PATH='\[\033[1;34m\]\W'  # show dir in blue
PS1_RESET='\[\033[0m\]'


# concatenate.

PS1="$PS1_TITLE$PS1_USER$PS1_AT$PS1_HOST$PS1_RESET $PS1_PATH \\$ $PS1_RESET"
unset -v PS1_TITLE PS1_USER PS1_AT PS1_HOST PS1_PATH PS1_RESET

#PS1='\033]2;\w\007\[\033[1;32m\]\u@\h \[\033[1;34m\]\W \$ \[\033[0m\]'


# Other magical prompts:

PS2='> '
PS4='\[\033[0;34m\]+\[\033[0m\] '

export PS1 PS2 PS4


JZL240I-U 11-14-2003 05:46 AM

Hey, interested noobs (like me) :D

Note, that PS1 (the control-string for your prompt) can be set at differing places for different users on your system. Here is what I could make out (without actual access to my system):

/etc/bashrc is used to set the prompt for the "true" consoles reached via <Alt><Crtl><Function key 1 through 6>

/root/bashrc is used to set the prompt for root with graphical login (under KDE)

/home/user/bashrc is used to set the prompt for user (your user-id here)

Please note, that some systems place a "." (without the "'s) in leading position of bashrc, thus generating .bashrc (dot-bashrc), which might be hidden in the file manager (activate "show hidden files") and to the ls-command (that's a small "L") so use the -a option (ls -a).

I do not know where PS2, PS3 ... PSN are set and what they are good for, exactly. Any takers? :D

@moderators (and gurus): checking and editing this post directly as necessary for errors and improvements is welcome. :)

yapp 11-14-2003 08:03 AM

PS2 is your secondary prompt, if you enter commands on multiple lines. for example, if statements, or while loops. (they require a 'counterpart'; a command that ends the statement)
PS4 is used if you enable "set -x", which shows all commands being executed.


from the bash manual you'll see what files are used. (just type "G" to skip to the end) files in /etc/ are usually global, and affect everyone using bash. files in your home directory overrule these global settings.

if you run bash from a login session (or bash -l), /etc/profile will be read, and from your home direcory: ~/.bash_profile, or ~/.profile.

In slackware, there is a /etc/profile.d/ directory where all *excutable scripts* are being executed by /etc/profile too. Some distributions don't have this, but you could add a few lines at the end of /etc/profile very easy:
Code:

# Append any additional sh scripts found in /etc/profile.d/:
for file in /etc/profile.d/*.sh ; do
  if [ -x $file ]; then
    source $file
  fi
done

...guess once, by bash prompt color script is located at /etc/profile.d/bash-prompt-color.sh ;) this affects all users.

a script can be made executable with this command:
chmod +x <insert filename here>

cwolf 11-14-2003 12:37 PM

For users: <user>@<host>$
and for root: <user>@<host>#

qanopus 11-14-2003 03:23 PM

mine is simple :

Code:

[sohail@linux /usr/local]$ echo $PS1
\[\033[37;01m\][\u@\h \w]$ \[\033[00m\]
[sohail@linux /usr/local]$


slightcrazed 11-14-2003 04:23 PM

[17:20:06] slight - slight>

Errr.... this is from memory, so no guarantees if it's wrong (which it probably is):

export PS1="\e[36;1m]\t\e[0m]\u - \w>"

slight

pibby 11-16-2003 06:51 PM

Cool stuff guys, but one quick question...
Mine is the standard pibby@localhost thing and I am wondering how I change the "localhost" part. For instance TrickyKid has drew@trickykid. Local host is so boring, I hope there is a way to change that.
Thanks in advance for any help you can offer :)

Scruff 11-16-2003 09:33 PM

Well, you could either change your actual hostname, or just use some of these tricks posted here. I am not positive about Mandrake, but I know in Slack there is a HOSTNAME file in /etc that you can edit to change it from localhost. I actually used netconfig, but I think thats a Slack-specific script.

pibby 11-17-2003 12:20 AM

Thanks for the help, I didnt realize that I could type anything in there, thought it had to be something like /h or /w. Thanks again :)

frieza 11-17-2003 02:19 AM

i use the default as well, but i have experimented with a few
C:$PWD>
for instance (not much of a fooler because of the slashes instead of backslashes but still kinda funny)

slakmagik 11-17-2003 06:24 AM

You're an evil person, frieza. :D It took me awhile to figure out and it's definitely not thoroughly tested, but it seems to work - I had a hard time going about it the wrong way. I set it pretty easily but couldn't get it to persist through 'cd' commands until I completely rethought it.

Try this Fake Working Directory in your ~/.bashrc or wherever. Very funny. *g*
Code:

PS1="C:\$(fwd)>"

function fwd () {
echo $PWD | sed 's/\//\\/g' | tr [:lower:] [:upper:]
}


a slacker 11-17-2003 06:55 AM

bash-2.05b$

DarkSpy 11-18-2003 01:52 PM

Code:

(19:51)[darkspy@Orion darkspy]$ cd Downloads/
(19:51)[darkspy@Orion Downloads]$ echo $PS1
($(date +%H:%M))[\u@\h \W]$
(19:51)[darkspy@Orion Downloads]$


Sammy2ooo 11-28-2003 03:52 AM

this is what my bash prompt looks like:

echo $PS1

Code:

\[\033[0m\]\[\033[1;33m\]\j\[\033[0m\]\[\033[1;30m\]\t\[\033[0m\]\[\033[31m\]\u\[\033[0m\]@\[\033[1;34m\]\033[37m\]\w$\[\033[0m\]

TheOneKEA 11-28-2003 06:25 AM

export PS1="[\u@\h \W]$ "
for normal users

export PS1="[\u@\h \W]# "
for root

[theonekea@Ganymede theonekea]$

But I may change it, after seeing the stuff in this thread.

synaptical 11-29-2003 12:29 AM

mine's also pretty basic:
PS1='\[\e[36;1m\]\u@\h:\[\e[34;1m\]\w \$\[\e[0m\]'
PS2=~>

i wanted to add the current directory to the title bar instead, to save space, but it messes things up when in console mode. :(

fatgod 11-29-2003 07:52 AM

< /usr/local/games >
[ Sat Nov 29 ¤ 13:34:11 --- fatgod @ odin ]
$ echo $PS1
\n\033[1;33m\] < \w >\n\033[1;32m\][ \d \244 \t --- \u @ \H ]\n \033[1;37m\]$


Which is virtually impossible to see on a light background... but works well enough on darkened tranparent windows. And when I 'su' the username turns red.

dkaplowitz 11-29-2003 07:59 AM

$

320mb 10-17-2004 04:05 PM

I make it easy on myself, at the top I define the colors I use.........
Code:

# Color Variables for Prompt
GRAD1='\333\262\261\260'
GRAD2='\260\261\262\333'
YLOBRN='\[\033[01;33;43m\]'
WHTBRN='\[\033[01;37;43m\]'
REDBRN='\[\033[01;31;43m\]'
BLUBRN='\[\033[01;34;43m\]'
GRNBRN='\[\033[00;32;43m\]'
REDBLK='\[\033[00;31;40m\]'
PPLBLK='\[\033[01;35;40m\]'
WHTBLK='\[\033[01;37;40m\]'
NONE='\[\033[00m\]'
HBLK='\[\033[00;30;30m\]'
HBLU='\[\033[01;34;34m\]'

BLU='\[\033[01;34m\]'
YEL='\[\033[01;33m\]'
WHT='\[\033[01;37m\]'
PRPL='\[\033[00;35m\]'
RED='\[\033[01;31m\]'
GRN='\[\033[01;32m\]'         
GRAY='\[\033[01;30m\]'
PINK='\[\033[01;35m\]'
NORM='\[\033[01;00;0m\]'
CYAN='\[\033[01;36m\]'


export GRAD1 GRAD2 YLOBRN WHTBRN REDBRN BLUBRN GRNBRN
REDBLK PPLBLK WHTBLK NONE HBLK HBLU BLU YEL WHT PRPL
RED GRN GRAY PINK NORM CYAN

my user prompt is this:
Code:

PS1="$GRN\h  $RED\w $YEL\$  $NONE$NORM"
Hence:
Chessmaster ~ $

When I'm root: Chessmaster is Red and the working directory is Green

oneandoneis2 10-17-2004 04:35 PM

I have a fairly bland command prompt. The only thing that I really like to have is a \n at the front, which puts a blank line between the last output and the new prompt

Bruce Hill 10-17-2004 05:47 PM

Glad you guys resurrected this thread. I searched for it a couple of
months ago but could not find it no matter what string I entered...

320mb 10-17-2004 06:34 PM

Quote:

Originally posted by Chinaman
Glad you guys resurrected this thread. I searched for it a couple of
months ago but could not find it no matter what string I entered...

I found it by accident.........I was searching for some info on /etc/profile.d
and came upon it...............hopefully it won't go dead again for awhile...........

SocialEngineer 10-17-2004 07:11 PM

[19:11:21][will@hexbox1lnx]$

PS1="[\t][\u@\h\\$ "

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:~$

David the H. 03-27-2011 06:07 AM

A couple of years ago I posted a script that I created that will truncate the $PWD and format it for use in the prompt.

Since then I've modified it some more and converted it into a function, and I use it like this:
Code:


#Set some color escape sequences.
#================================#
export RESET='\e[0m' #disable any colors

# Regular colors.
export BLACK='\e[0;30m' RED='\e[0;31m' GREEN='\e[0;32m' YELLOW='\e[0;33m'
export BLUE='\e[0;34m' MAGENTA='\e[0;35m' CYAN='\e[0;36m' WHITE='\e[0;37m'

# Bolded colors.
export BBLACK='\e[1;30m' BRED='\e[1;31m' BGREEN='\e[1;32m' BYELLOW='\e[1;33m'
export BBLUE='\e[1;34m' BMAGENTA='\e[1;35m' BCYAN='\e[1;36m' BWHITE='\e[1;37m'

#=========================#
# Command prompt settings #
#=========================#

# Function for setting a nice variable-length shell prompt.
#==========================================================#
function variprompt {

# This function takes the $PWD or other input string and truncates it to a
# set percentage of the terminal width.  It's designed for use in the bash
# $PS1 prompt to keep it from taking up too much space.  There may be minor
# variations in the actual length due to rounding in the arithmetic.

# Set the desired width of the string below as the percentage of the total
# terminal width.  Remember that any other parts you add to the prompt (such as
# username) will take up additional space.  Also be aware that this script is
# designed for reasonable numbers, and may act in unpredictable ways if the
# target and/or terminal width are very small.  Target values under 25 are not
# recommended.  Will use $1 if it exists, or defaults to the set value.

TARGETPCT=${1:-40}

# Get the current directory or input string.  This will $2 if it exists, or else
# It will default to $PWD.  In addition, if the string includes the $HOME
# directory, it will truncate it to "~".  Simply comment out the second line if
# this behavior is unwanted and you always want the full path.

CURRENTDIR="${2:-$PWD}"
CURRENTDIR="${CURRENTDIR/#$HOME/~}"

# Be sure that the shopt option "checkwinsize" is enabled, so that the curent
# shell width (COLUMNS) is available to this function.  If the $COLUMNS variable
# is unavailable, the following line will set it to 100 instead.  Alternatively,
# you can manually set this variable to a fixed value of 100, and the output
# will always be TARGETPCT columns wide.

COLUMNS=${COLUMNS:-100}

# Determine the number of characters in the input string and calculate
# the total target length and the sizes of the starting and ending segments.

CURRENTLENGTH="${#CURRENTDIR}"
TARGETLENGTH="$(( COLUMNS * TARGETPCT / 100 ))"
FIRSTPART="$(( TARGETLENGTH / 3 - 3 ))"
LASTPART="$(( CURRENTLENGTH - ( TARGETLENGTH * 2/3 ) ))"

# Finally we compare the current length of the prompt to the target length
# and print the appropriate output string.

if (( CURRENTLENGTH <= TARGETLENGTH )); then

    # No modifications are necessary. Print the unmodified string.
    echo "$CURRENTDIR"

else

    # Very small target or column values can make "FIRSTPART" zero or less.
    # So test it to avoid throwing out an error, and set it to display only the
    # first two characters of the string in such situations. Otherwise, print
    # the desired truncated string.

    if (( FIRSTPART > 1 )); then
          echo "${CURRENTDIR:0:$FIRSTPART}...${CURRENTDIR:$LASTPART}"
    else
          echo "${CURRENTDIR:0:2}...${CURRENTDIR:$LASTPART}"
    fi

fi

}

# End function.
#==============#

# Set the prompt.
#================#

# Set checkwinsize option, it's needed to ensure COLUMNS variable is read properly.

shopt -s checkwinsize

# Pattern to set the window title portion of the prompt, if in an xterm.
# The formatting pattern goes between '\e]0;' and '\a' (\a = \007).

if [[ "$TERM" =~ xterm ]]; then
    XTITLE='\e]0;\u:$(variprompt 55 2>/dev/null)\a'
else
    unset XTITLE
fi

# Define PS1 for root and regular users.  Must unquote all the variables.
# Escape sequences must be enclosed in \[ and \] brackets.

if (( UID == 0 )); then
    export PS1='\['${XTITLE}$BRED'\]\u:[\['$MAGENTA'\]$(variprompt 2>/dev/null)\['$BRED'\]]##\['$RESET'\] '
else
    export PS1='\['${XTITLE}$BGREEN'\]\u:[\['$BBLUE'\]$(variprompt 2>/dev/null)\['$BGREEN'\]]$\['$RESET'\] '
fi

Yeah, it seems quite long, but it's mostly comments. :)
The result looks something like this:
Code:


david:[~]$ cd /mnt/musicdir/western_artists/Beatles--Albums/08_Sgt_Peppers_Lonely_Hearts_Club_Band/
david:[/mnt/musicdi...ppers_Lonely_Hearts_Club_Band]$

...but in color. Note also how the window title string can be set to a different length from the prompt itself.

Scruff 03-27-2011 01:25 PM

Whoa, haven't seen this thread in awhile. Mine now looks like:

[sean.bitwise: /home/sean]$

It also turns to red when a command fails, back to green under normal conditions.

PHP Code:

export PROMPT_COMMAND='PS1="\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u.\h: \`if [[ `pwd|wc -c|tr -d " "` > 18 ]]; then echo "\\W"; else echo "\\w"; fi\`]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007"' 


bret381 03-30-2011 06:06 PM

mine looks like this:

┌─[18:04:17]──[bret]──[Ziggy]:~$
└──(28 files, 3.5Gb)>>

Code:

PS1="\[\e[01;37m\]┌─[\t]──[\[\e[01;37m\u\e[01;37m\]]──[\[\e[00;37m\]${HOSTNAME%%.*}\[\e[01;37m\]]:\w$\[\e[01;37m\]\n\[\e[01;37m\]└──\[\e[01;37m\](\[\e[32;1m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, \$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[01;37m\])>>\[\e[0m\]"

Aquarius_Girl 03-30-2011 08:15 PM

Quote:

Originally Posted by bret381 (Post 4308998)
mine looks like this:

┌─[18:04:17]──[bret]──[Ziggy]:~$
└──(28 files, 3.5Gb)>>

What is the way to type that special character there? The starting character I mean.

bret381 03-31-2011 08:30 AM

Quote:

What is the way to type that special character there? The starting character I mean.

I don't have a clue. haha, I used the archbang default prompt (which has that character) and added some stuff.


All times are GMT -5. The time now is 10:24 AM.