Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

What Does Your Command Prompt Look Like?

CmdrTaco posted more than 13 years ago | from the a-little-less-serious dept.

It's funny.  Laugh. 568

rogain writes: "Show your commandline coolness and post your ubergeek .profile Donate a clue to the newbie hordes amazed that you can even change the command prompt! A nerdly sort of show-me-yours and I'll-show-you-mine kind of thing." I've attached mine below, but its kinda boring. I'm looking forward to seeing someone come up with a cooler one!

Here's mine:
PS1="$E\033]2;\h:\u:\w\007\033]1;\h\007$R$E$REDBLK$R\u$E$PPLBLK$R@$E$REDBLK$R\h$E$NONE$R\w>"

cancel ×

568 comments

Sorry! There are no comments related to the filter you selected.

Re:prompt (1)

Anonymous Coward | more than 13 years ago | (#103943)

that'd be "prompt $p$g" if I remember correctly.

you nerds (2)

Anonymous Coward | more than 13 years ago | (#103946)

get a life

Mine: Lots of info, lots of colors. Link to code (3)

Erich (151) | more than 13 years ago | (#103952)

Because of the lameness filter, I have put my prompt code here [wreck.org] That's Date in red, number of messages in my mail spool file in brighter red, current umask in red, current username and active group name in blue, current path in green, hostname in bright green, current command history number, and exit status of the previous command. It's pretty sick. But it provides lots of information.

Two-liner (1)

Scott Wunsch (417) | more than 13 years ago | (#103958)

[scott@pytheas] [pts/4] [~]
[0] [213] %

I use a two-line prompt. Why? Because I can have a really long directory name, and there's still room to type a decent command line without running off the edge of the screen!

(There's actually colour to it too, but I won't post the actual prompt definition, because it's full of literal escape sequences. I knew memorising all those ANSI codes would pay off someday! :-))

Re:Chaneges color when uid=0? (1)

Scott Wunsch (417) | more than 13 years ago | (#103959)

Okay, fine, maybe I will post my actual prompt. It actually does that; the username root will turn up in red; everybody else is cyan. This requires zsh, of course :-).

PROMPT='%{ESC[0;1;37m%}[%(0#.%{ESC[31m%}.%{ESC[3 6m %})%n%{ESC[37m%}@%{ESC[36m%}
%m%{ESC[37m%}] [%{ESC[36m%}'${ttyprefix}'%l%{ESC[37m%}] [%{ESC[36m%}%~%{ESC[37m%
}]
[%(0?.%{ESC[32m%}.%{ESC[31m%})%?%{ESC[37m%}] [%{ESC[36m%}%!%{ESC[37m%}] %{ESC[33
m%}%# %{ESC[22;36m%}'

POSTEDIT='ESC[0m'

Re:this is just absurd (1)

Scott Wunsch (417) | more than 13 years ago | (#103960)

IMO, doing stupid shit like this shows your ignorance even more. Woohoo! I changed my command-line, big f*g deal. That's takes about as much skill as it did changes the text in old DOS programs. (Open it up in a hex-editor and start modifying strings.)


You're right; it doesn't necessarily show any particular skill. But did you ever consider that it might be useful? My prompt tells me a lot more than the default one does, and I find that useful. I like seeing other people's prompts, because it gives me ideas of useful information that I could include in mine.



Is that a bad thing?

Re:this is just absurd (2)

Have Blue (616) | more than 13 years ago | (#103964)

Note that that is the FIRST tutorial. What was the first program you ever wrote? Hello world?

And you must admit it's a hell of a lot better than the kid trying to get started by cracking sites and turning into a script kiddie.

My prompt (yes this is really old) (3)

Have Blue (616) | more than 13 years ago | (#103965)

C:\> C:\spot> C:\spot>run run spot run!

Re:KSH Prompt? (2)

Dom2 (838) | more than 13 years ago | (#103970)

Ksh will expand environment variables when it diplays, so you can do:

PS1='$PWD$ '

(Note the single quotes)

-Dom

I good trick to play (5)

smartin (942) | more than 13 years ago | (#103972)

Change someone elses prompt to "". Drives them crazy
until they figure it out.

Just the basics (2)

Chacham (981) | more than 13 years ago | (#103973)

PS1='\w>'

---
ticks = jiffies;
while (ticks == jiffies);
ticks = jiffies;

Something like this (2)

Chacham (981) | more than 13 years ago | (#103974)

select user_id, lower(username) user_name from user_users where username = user; select lower(substr(global_name,1,(instr(global_name,'.', 1,1)-1))) db_name from global_name; rem set the prompt set sqlprompt "&db_name::&user_name> "

---
ticks = jiffies;
while (ticks == jiffies);
ticks = jiffies;

My bash prompt. (2)

j.e.hahn (1014) | more than 13 years ago | (#103975)

Here's how I set it in /etc/profile on all my boxen:

case $USER in
root)
PS1="(\# \u \h \w)\n>> "
;;
*)
PS1="(\# \u \h \w)\n> "
;;
esac
export PS1

This means that my prompt looks like this if I'm a user:

(1 jeh myhost /home/jeh/foo/bar/bletch)
>

and as root

(1 root myhost /usr/local/lib/perl/5.6.1)
>>

So I can tell at a glance exactly who and where I am, and still have nearly a full screen width for commandline editing.

prompt (1)

Arlo (1223) | more than 13 years ago | (#103981)

set prompt="%m %B[%t]%b %n [%/]%#"

tcsh.

Re:Chaneges color when uid=0? (1)

betaray (1268) | more than 13 years ago | (#103982)

You can always put a different .profile in ~root, or add this to your /etc/profile:

if [ "`id -u`" = "0" ]; then
#setup root prompt
else
#setup user prompt
fi

'leet color prompt (4)

betaray (1268) | more than 13 years ago | (#103983)

ph33r my prompt! Color, upper asci, username, machine and date!!!

(Actually I kinda ripped the idea off from Mandrake (the Enlightenment guy), but there are some changes).

export PS1="\[\033[11m\[\033[0;34m\[\332\304\[\033[1;34m\ [\304\[\033[0;34m\[(\[\033[0;36m\[\u@\h\[\033[0;34 m\[)-(\[\0
33[1;34m\[\`date +\"%a %B %-d %l:%M%P\"\`\[\033[0;34m\[)\[\033[1;34m\[\304\[\033 [0;34m\[\304\n\300[\[\033[0;36m\[\w\[
\033[0;34m\[]:\[\033[0;0m\[ \[\033[10m"

lame - but effective (1)

SiliconJesus (1407) | more than 13 years ago | (#103984)

PS1="\H:\w# "

Work at ISP with literally hundreds of UNIX boxen. This keeps it easy to type (we use kerb and login as root) and doesn't interfere with the other sysadmins preferences.

Secret windows code

My prompt (2)

Brian Kendig (1959) | more than 13 years ago | (#103990)

yes, master? ~

zsh prompt... (2)

kevin lyda (4803) | more than 13 years ago | (#104013)

note the ^[ bits are escapes. C-v ESC in vi.

if [[ $OSTYPE == solaris2 || $OSTYPE == osf4.0 ]]; then
PS1='%n@%m(%(t.Ding.%@))%# '
else
PS1='%n@%m(%(t.Ding.%D{%l:%M%P}))%# '
fi
RPS1="%B%{^[[35m%}[%20<..<%~]%{^[[30m%}%b"
export PS1 RPS1

Re:Blue Screen of Death (in DOS) (1)

Glytch (4881) | more than 13 years ago | (#104014)

Maybe that's what I miss most about MSDOS. It was crippled and badly designed and basically useless, but I never, ever saw it crash.

My bland Prompt (1)

Doctor_D (6980) | more than 13 years ago | (#104031)

My prompt is quite simple...but on the sheer number of machines I have an account on or root on, it works fairly well.

PS1="`hostname`:$LOGNAME:# "
-- # for root, $ for user.

Pretty basic, but then I'm more for minimalistic sorts of things. For example I don't use GNOME, KDE or CDE, but I like FVWM or Enlightenment.

--
"If you insist on using Windoze you're on your own."

prompts in zsh (1)

Tharsis (7591) | more than 13 years ago | (#104034)

does anyone know how to do a 2 line prompt in zsh?

bash prompt with colored hostname (1)

kampi (7720) | more than 13 years ago | (#104035)

Living in several networks I like to have intuitive signal where I am by first making the hostname standout (colored) and second using different colors in different networks.

This is one of them
\[\033]0;\h:\w\007\]\u@\[\033[1;34m\]\h\[\033[0m\] :\W>

Command prompt? (4)

grub (11606) | more than 13 years ago | (#104054)

I have a Mac here, so in my house a command prompt is something that triggers my wife to bark orders at me. :)

grub

yes it's a joke

colorful and functional .bash_login.... (1)

Gaewyn L Knight (16566) | more than 13 years ago | (#104071)

function fire
{
local COLOR_RED='\[\033[00;31;40m\]'
local GRAD0='\[\033[00m\]'
PS1="$COLOR_RED\h$GRAD0 "
}
function green
{
local COLOR_GREEN='\[\033[0m\033[32;40m\]'
local GRAD0='\[\033[00m\]'
PS1="$COLOR_GREEN\h$GRAD0 "
}

if [ $UID == '0' ] ; then
fire
else
green
fi

Simple... but it keeps me from destroying stuff as root and not knowing it...

My Prompt, Boring But Effective. (1)

Bowie J. Poag (16898) | more than 13 years ago | (#104072)


PS1="[\h][\w] : "

In longhand, it shows [Hostname][Fully Expanded Path] username :

Evil things to do in a shell prompt: (1)

Bowie J. Poag (16898) | more than 13 years ago | (#104073)



If you're looking for a unique way to crash the almighty pound bang slash bin slash bash, try this on:

PS1=`cat /proc/kcore`

Whammo. No more xterm.

Then again, a 256MB-long shell prompt may not be such a good idea, but its a bug nonetheless.

2 line green to white (2)

ripler (19188) | more than 13 years ago | (#104083)

set prompt="%{^[[1;32;40m%}%t-%n@%m\n%/%{^[[0;37;40m%} > "

Does this count? (1)

thewiz (24994) | more than 13 years ago | (#104096)

PS1="/."

Chaneges color when uid=0? (1)

imagi (27636) | more than 13 years ago | (#104099)

Does anyone have a method to maybe change the color of the prompt or background when you su to root. This would be very useful.

Re:prompt (1)

imagi (27636) | more than 13 years ago | (#104100)

Zsh Rules: PROMPT="%{$COLOR3%}[%{$COLOR1%}%n%{$COLOR3%}@%{$CO LOR1%}%m%{$COLOR3%}[%{$COLOR1%}tty%l%{$COLOR3%}]%{ $COLOR1%}%~%{$COLOR3%}]%{$COLOR1%}%(#.#.$)%{$COLOR 4%}

Use a real shell! (2)

PigleT (28894) | more than 13 years ago | (#104104)

zsh, storm 4:21PM tim % echo $prompt
zsh, %m %t %C %#
zsh, storm 4:21PM tim %

Bingo :8)
~Tim
--
.|` Clouds cross the black moonlight,

tcsh! (2)

Aqualung (29956) | more than 13 years ago | (#104108)

From my .tcshrc...
unset prompt
set foo=`whoami`
set prompt="%B$foo@%m%b:%U%/%u%#"


What this does:

dave@nol:/staff/dave>

This allows me to see my EUID at a glance (I never use su -, I like keeping my own environment!) and which machine I'm running on, and where exactly in the filesystem I am. I don't really need more than that from a shell prompt.

----
Dave
MicrosoftME®? No, Microsoft YOU, buddy! - my boss

Plenty of examples on the web... (2)

fReNeTiK (31070) | more than 13 years ago | (#104111)

here [shelluser.net] ...

Don't forget to read trough the HOWTO [linuxdoc.org] if you really want to know what you're doing

Mine is:


PS1="$TITLEBAR\
$GRAY[\
$COLVAR\u$GRAY@$LIGHT_BLUE\h$GRAY:$BROWN\W\
$GRAY]\
$COLVAR\\$ $LIGHT_GRAY"


You have to define the $COLOURS first of course...

command prompts are a great way to waste time (1)

htmlboy (31265) | more than 13 years ago | (#104112)

i decided i needed a cooler prompt this past semester. so instead of attending to college, i came up with these:

in tcsh:
set prompt="%{\033]0;%n@%m:%~\007%}%{\033[0;30m%}%B%n% b@%{\033[0;34m%}%B%m%b%{\033[0;37m%}:%~ %B>%b "

that sets the window title to user@host:/path along with coloring the prompt. it's not advisable to use at the console. you can just cut off the first part to remove the window title code.

in bash:
export PS1="\[\033]0;\u@\h:\w\007\]\[\e[30;1m\]\u\[\e[0m\ ]@\[\e[34;1m\]\h\[\e[0m:\]\w\[\e[31;1m\] #\[\e[0m\] "

exact same thing, except with more slashes.

anyway, that's what i like using. i'm looking forward to seeing some other suggestions once the moderators go through here.

chris

Re:Oh Yeah (1)

htmlboy (31265) | more than 13 years ago | (#104113)

You can load your command prompt with tons of worthless crap.

it's the worthless crap that keeps me from typing shutdown -r now on an important machine when i think i'm just ssh'd to my completely unimportant linux box to try out the kernel i compiled last night. nothing like taking down the radius server at an isp :)

chris

Re:What's a command prompt? (1)

jerk (38494) | more than 13 years ago | (#104127)

"...or the Windows user who never had a crash..."

Yeah....like those exist.

Re:my net worth on the command line (3)

[amorphis] (45762) | more than 13 years ago | (#104137)

gives new meaning to the term "bottom line" :-)

Re:Blue Screen of Death (in DOS) (2)

operagost (62405) | more than 13 years ago | (#104157)

I did... EMM386 was pretty good for that, but usually it took Windows 3.x to get the ball rolling.

fairly plain (1)

coug_ (63333) | more than 13 years ago | (#104158)

PS1='\u@\h: ' Am I the only one who puts a space at the end of the prompt?

I guess I'm really boring (2)

shed (68365) | more than 13 years ago | (#104165)

But I've never thought it worth changing. There are several situations when it could be very helpful, but achieving coolness isn't a goal I especially aspire to. Am I alone in this? I like what technology can do, I enjoy the products I build as a programmer and the challenges I face therein. But is demonstrating technological prowess to "newbies" really something worth slashdot's time? Guess I'm just an old grouch.

For tcsh'ers with lots of machines... (1)

ref7 (72679) | more than 13 years ago | (#104174)

Change your xterm title as well as your prompt to include the hostname of the current machine + dir...

set prompt="%{\033]0;%n\@%m [%~]\a%}[%U%m%u:%B%~%b]%# "

my prompt on 2 lines (2)

lovebyte (81275) | more than 13 years ago | (#104187)

To use with tcsh:
set prompt="-------%B%n:%m:%/:%T%b-------\n%h%% "

This looks like:

-------username:hostname:/path/path:17:12-------
101%

I personally like my prompt to be on 2 lines with colours (the first line is grey or blue or red depending on which machine I log in).

Prompt for MCSE's (1)

kelzer (83087) | more than 13 years ago | (#104191)

Type "EXIT" to return to Windows$G

Re:Prompt for MCSE's - version 1.1 (1)

kelzer (83087) | more than 13 years ago | (#104192)

Type "EXIT" (without the quotes) to return to Windows$G

Color coded full line (1)

nahdude812 (88157) | more than 13 years ago | (#104199)

export PS1="(\# \[\033[0;31m\]\u@\h \[\033[0;34;1m\]\w\[\033[0;37m\])\n> "

looks like this: (with <COLOR> indicating its color, DUH)
<Normal>(46 <RED>mightye@tux <BLUE>/var/log<Normal>)
>

Yours looks EASY (3)

blakestah (91866) | more than 13 years ago | (#104207)

Try this one. Use color !

export PS1='\[\e[0;31m\]\u\[\e[1;37m\]@\[\e[0;37m\]\h\[\e [0;36m\](\W)\[\e[0;0m\]$ '

A myriad (2)

polymath69 (94161) | more than 13 years ago | (#104210)

In color xterms, I use
PS1="\[\e[1;36m\](\[\e[1;33m\]\u\[\e[1;31m\]@\[\e[ 1;33m\]\h"
PS1="${PS1}\[\e[1;36m\e]2;xterm: \w\007\])\$\[\e[1;32m\] "
PS2="\[\e[1;36m\]>\[\e[1;32m\] "

In vanilla xterms,

PS1="(\u@\h)\[\e]2;xterm: \w\007\]\\$ "

For other term types:

PS1="(\h)[\w]\\$ "

On my DOS box, of course, it's different;

prompt=$e[s$e[44;37;1m$e[1;1H $d %_time Directory $P$e[K$e[1;62H Shell $z %@do smem[K]K free$e[K$e[0m$e[u$e[1;33m$ Then I said, "$e[36m


--

My prompt... (1)

TheCarp (96830) | more than 13 years ago | (#104214)

Well in bash I use this:
[sjc@brake sjc]$ echo $PS1
[\u@\h \W]\$ \[\033]0;\u@\h \w\007\]

Pretty simple... takes who and where I am, and sends the info to my terminal windo so it can set the title bar apropriatly.

Of course, my terminal windows don't have title bars (or even boarders), but it does make the window list work a bit better ;)

-Steve

Re:My favorite for bash (1)

Atzanteol (99067) | more than 13 years ago | (#104218)

Now *that* is cruel!

I hope nobody runs this...

Simple, un-stupid. (2)

Torke (101454) | more than 13 years ago | (#104223)

export PS1="(\u@\h) [\w]\\$ " -- Torke http://anarchy.ca

I keep mine nice and boring (1)

11thangel (103409) | more than 13 years ago | (#104227)

I'm using an Eterm 99% of the time, and the nice pretty bg on that keeps my eyes occupied enough for a dull old [root@net /root]# to keep me happy.

KSH Prompt? (1)

Cheshire Cat (105171) | more than 13 years ago | (#104228)

As much as I hate to admit I cannot figure this out, how do I put my current directory in my prompt, in KSH?

random prompt (2)

dezwart (113598) | more than 13 years ago | (#104246)

PS1=`cat /dev/urandom`

A little bit of bash color. (1)

segoave (115819) | more than 13 years ago | (#104249)

PS1="\[\033[1;33m\]\# \h:\W>\[\033[0m\]"

Also truncates the path.

My DOS command prompt (1)

basscomm (122302) | more than 13 years ago | (#104259)

prompt $d$t$p$g

Huh? It can be very useful (1)

JiveDonut (135491) | more than 13 years ago | (#104281)

If you log into a lot of boxes having a good command prompt can make a big difference. A different color or having the hostname in the prompt can prevent making a silly mistake.

prompt too long? (2)

The Pim (140414) | more than 13 years ago | (#104285)

My otherwise boring prompt uses a nifty zsh feature to keep the line from getting too long.

%m %n %30<..<%~%#

left-truncates the path to 30 characters, with a leading ...

Re:I keep mine nice and boring (1)

vicviper (140480) | more than 13 years ago | (#104286)

hmmm, pr0n prompt eh? hmmm images of ascii pr0n comes to mind....

Re:Chaneges color when uid=0? (1)

binford2k (142561) | more than 13 years ago | (#104294)

COLOR1="\[\033[0;36m\]"
COLOR2="\[\033[0;32m\]"
COLOR3="\[\033[0;36m\]"
COLOR4="\[\033[0;37m\]"

if [ "$UID" = "0" ];
then
COLOR2="\[\033[0;31m\]"
fi

PS1="$COLOR2($COLOR3\u@\h$COLOR2)-($COLOR1\@$COL OR 2 $COLOR1\d$COLOR2)-($COLOR1\W$COLOR2)$COLOR1\n$COLO R1\\$ $COLOR4"

if [ "$TERM" = "xterm" -o "$TERM" = "xterm-color" -o "$TERM" = "xterms" ];
then
PROMPT_COMMAND='echo -ne "\033]0;<${USER}@${HOSTNAME}>: ${PWD}\007"'
export PROMPT_COMMAND
fi

How about this (3)

dante101vr2 (144352) | more than 13 years ago | (#104299)

alias ll='ls -l --color=tty' alias l.='ls .[a-zA-Z]* --color=tty' alias ls='ls --color=tty' alias la='ls -al --color=tty' LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33: so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi =01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=0\ 1;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;3 2:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31: *.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=0\ 1;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:* .tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.g if=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01\ ;35:*.png=01;35:*.tif=01;35:' I think the rainbow of color cheers me up.

Re:2 liner, if your into that sort of thing... (1)

Tomun (144651) | more than 13 years ago | (#104300)

I do, but without all the color.

export PS1='\u@\h:\w/\n\$ '

Finally geek stuff! (2)

don_carnage (145494) | more than 13 years ago | (#104301)

PS1=\n[\u@\h:\w]\n$

No fancy colors, just funtionality. *gasp* my ls doesn't even have colors! Oh yeah...OBSD.

--

2 liner, if your into that sort of thing... (3)

galihad (150973) | more than 13 years ago | (#104309)

NORMAL=`tput sgr0 2> /dev/null`
BOLD=`tput bold 2> /dev/null`
RED="\[\033[31m\]"
GREEN="\[\033[32m\]"
BLUE="\[\033[34;1m\]"
GREY="\[\033[1;30m\]"
PURPLE="\[\033[0;35m\]"

PS1="$PURPLE\t$GREY:$BLUE\w\n$RED\u$GREY@$GREEN\ h$ GREY>$NORMAL"
PS2="$GREY>$NORMAL ";

I thought everyone used (1)

dmccarty (152630) | more than 13 years ago | (#104312)

PROMPT $P$G

Sure to freak a coworker out (1)

PoitNarf (160194) | more than 13 years ago | (#104323)

prompt Abort, Retry, Fail?

Prompness... (2)

dgryn (162552) | more than 13 years ago | (#104326)

export BOXNAME=`hostname | awk -F. '{print $1}'`
PS1="^[[31;1m[\`date +%H:%M\` $BOXNAME] ^[[32;1m"'${PWD##*/}'"^[[0m> "

Re:Blue Screen of Death (in DOS) (1)

andr0meda (167375) | more than 13 years ago | (#104328)


Consider yourself lucky, it was easy enough to generate a general protection fault. I remember Ctrl-P hanging the kernel in an IO problem loop, also floppy IO operations had their moments of 'reasonable doubt', and certainly memory managers like Qemm and PMode/W were notoriously unstable, and generated somehting comparable to NT`s BSOD. basicly anything hooked into an IRQ or BIOS was (is for me;)) able to crash your box.

my net worth on the command line (3)

bergeron76 (176351) | more than 13 years ago | (#104335)

For mine I wrote a script that pulls my bank account info, parses it and puts my net worth into an evironment var. Thus, my prompt looks like so:

[$53,432,566:root@hemorrhage /]#

nifty eh?


My prompt... (1)

Gordonjcp (186804) | more than 13 years ago | (#104347)

... is a flashing "K", just after the copyright message.

48k ought to do it...

Not too shabby... (2)

Kazymyr (190114) | more than 13 years ago | (#104351)

...but I like a ':' before my '\w', thank you.

obey (2)

abe ferlman (205607) | more than 13 years ago | (#104365)

This was my prompt on the Sun machines we logged into for years at Pitt:

Yes, Master?>

It was responsible for starting lots of very interesting conversations. I'd almost forgotten!

Bryguy

Bash Prompts (1)

Lechter (205925) | more than 13 years ago | (#104366)

Well I use two prompts, depending on whether my terminal supports color. Some terminal programs like Humingbirds switch to an illegible font when you try to escape to colors.

Without color:

PS1='$NAME:(`date +%r`) \h:\w\$ '

With color:

PS1=`echo -n -e "\033[0m\033[4m\033[34m$NAME\033[0m\033[34m:\033[3 1m(\033[1m\033[35m";date +%r; echo -n -e "\033[0m\033[31m)\n\# \033[5m\033[12m\h:\033[0m\033[1m\033[12m\w\$\033[0 m "`

$NAME is my name as it's set in /etc/passwd. The two statements specify a two-line prompt. On the topline is my name (blue and underlined) followed by the time (in another color). On the second line is the command number I'm about to execute followed by the name of the server, and my current directory. ...Only took me three on-and-off years to come up with, back when I started playing around in Linux and FreeBSD way back in High School. ;-)

Yeah, but does yours use gawk? (1)

Flat5 (207129) | more than 13 years ago | (#104369)

PS1="\[\033]0;\u@\h: \w\007\]\[\033[1m\]\u@\h(\$(pwd | gawk -F '{if (NF>n+1)
{for (i=NF+1-n; i=NF; i++) printf \"/%s\", \$i} else {for (i=2; i=NF; i++) printf \"
/%s\", \$i}}' n=3 | sed -e 's/\/home\/userid/~/'))\$\[\033[0m\] "

userid@machine(tilde abbreviated path trimmed to custom depth)$

The whole thing is bold.

all evil (4)

X-Dopple (213116) | more than 13 years ago | (#104380)

[root@allevil]$

Yes, my machine is named 'allevil' and I am the root of it.

Command prompt? (1)

jamesots (214246) | more than 13 years ago | (#104382)

I usually just have a nice white arrow. But when I must, my prompt is plain old $P$G.

Article at developerworks (1)

JRiddell (216337) | more than 13 years ago | (#104388)

This article [ibm.com] at developerworks shows you how to do all the fancy bits.

Mine is \[\e]2;\u@\H \w\a\e[34m\]\u@\h\[\e[0m\]:\[\e[36m\]\w\[\e[0m\]>

But mind and set your .bashrc to test for TERM being something that can handle the colours

The one I see most often... (1)

csmacd (221163) | more than 13 years ago | (#104394)

Router(config-if)# But, then, I'm a Cisco geek...

Re:this is just absurd (2)

unformed (225214) | more than 13 years ago | (#104400)

And you must admit it's a hell of a lot better than the kid trying to get started by cracking sites and turning into a script kiddie.

You're right. Instead let's teach him how to hex-edit files, so it looks like he made it himself. Yep, on the road to becoming a script-kiddie.

No I'm not saying they need to be taught how to break into websites. They shouldn't at all.

They should be taught how to program. I'd recommend everyone learning either C or asm as a first language; it makes you understand the computer, and how things work.

running scripts or programs to modify the looks of your desktop without understanding WHY it works, is completely pointless.

mine (1)

zephc (225327) | more than 13 years ago | (#104401)

PS1='[\u@\h \W]\$ '

i use this on every system i use
----

my zsh prompt (1)

room101 (236520) | more than 13 years ago | (#104415)

Not colourfull, but I find it very usefull:
PROMPT="%B%S%($(/usr/bin/id -u jwalker)#..%n)%s:%m:$(basename $(tty)):%(?..%S%?%s:)%b"

The first part is colon delimited (yes, very geeky).
#1, if I am not myself (su'ed), the user name is in standout; otherwise, blank, so the prompt starts with a colon.
#2, the box name
#3, the tty (usefull when doing curses work)
#4, lastly, the return code of the last program (contents of $?) in standout; if it is zero (all okay, it is nothing.

Now for the right-hand side (I love zsh):
if [[ ! -z $PSVAR ]]
then
RPROMPT="%B%~:(%*)%S$PSVAR%s%b"
else
RPROMPT="%B%~:(%*)%b"
fi

This is basicly the CWD (relitive to ~), colon the current time. Then, if $PSVAR is defined, display it. I used this when I worked with Informix, and there were multipule instances, so I needed to know when one I was connected to.

HTH someone. Such a self indulgent topic, but I guess that pretty much sums up most of /. (;-)

My ksh prompt (1)

Mr-Pope (245456) | more than 13 years ago | (#104423)

PS1="`whoami`@`hostname` {!}$ "

Still in 2k (2)

DaHat (247651) | more than 13 years ago | (#104427)

Command prompt... I don't use that to much these days, when I do it says... handofthrawn>

Re:Prompt for MCSE's - version 1.1 (1)

snafui (255561) | more than 13 years ago | (#104434)

No, you don't click on things here$G

Atari 800 (1)

ceesco (259588) | more than 13 years ago | (#104436)

READY

At least, if I remember correctly ;)

Simple is better (1)

pdiaz (262591) | more than 13 years ago | (#104441)

export PS1="[\W]-> "
and faster

From the old mnet/arbornet days (1)

nquartz (263550) | more than 13 years ago | (#104443)

'Your Blood? '

prompt (5)

KupekKupoppo (266229) | more than 13 years ago | (#104448)

c:\>

prompt (1)

er0ck (267290) | more than 13 years ago | (#104449)

UNI%

bash prompt (1)

no names left!!! (323949) | more than 13 years ago | (#104468)

COLOR1="\[\033[1;35m\]" COLOR2="\[\033[1;36m\]" COLOR3="\[\033[0;35m\]" COLOR4="\[\033[0m\]" PS1="\[$COLOR2[\u@$COLOR1\h][$COLOR2\W]\[\\$\] $COLOR4" - and i noticed that when i put yours in and tried it it didn't wrap propperly !! Mine did that for a while - had to do a bit of tinkering but got it working in the end.

My old DOS prompts (1)

ecarlson (325598) | more than 13 years ago | (#104469)

In the olden days I used 2 ANSI prompts for DOS, one when I was in pure DOS, and one when I was in a DOS window.

1. SET PROMPT=$e[1;37;45m$p$e[1;31;45m\$e[1;33;44m

2. SET WINPMT=$e[1;33;44m[Windows]$e[1;37;45m $p$e[1;31;45m$g$e[0;34;46m

Of course they both require ANSI.SYS.

Re:prompt (2)

bark76 (410275) | more than 13 years ago | (#104473)

c:\>

Mine used to say that, but now all I get is this blue screen :(

ok, i now become troll and flaimbait in one (1)

circletimessquare (444983) | more than 13 years ago | (#104482)

just look at my sig ;-)

Oh Yeah (2)

Tachys (445363) | more than 13 years ago | (#104484)

You can load your command prompt with tons of worthless crap.

Yeah that will impress the newbies.

i always like aquare brackets (1)

trash eighty (457611) | more than 13 years ago | (#104492)

my prompt on unix boxen is usually like :

[username]

sometimes i put the path in there too. it reminds me of the OS/2 prompt... ah i loved that

Re:prompt (1)

nyxxie (460418) | more than 13 years ago | (#104498)

Mine:

NEMESIS [ntsh]>

Show me your Can (1)

Skyleth (460976) | more than 13 years ago | (#104499)

[server] [dir] %

Re:prompt (1)

paulpas (461246) | more than 13 years ago | (#104500)

C:ENTER:###

2 lines (1)

unixpro (464350) | more than 13 years ago | (#104504)

Boring, but shows the current directory on one line, with the hostname and history number on the next. PS1=\w\n[\h] \!\$
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?