Slashdot Mirror


What Does Your Command Prompt Look Like?

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>"

35 of 568 comments (clear)

  1. Mine: Lots of info, lots of colors. Link to code by Erich · · Score: 3

    Because of the lameness filter, I have put my prompt code here 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.

    --

    -- Erich

    Slashdot reader since 1997

  2. My prompt (yes this is really old) by Have+Blue · · Score: 3

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

  3. I good trick to play by smartin · · Score: 5

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

    --
    The difference between Canada and the USA is that in Canada healthcare is a right and gun ownership is a privilege.
    1. Re:I good trick to play by Tet · · Score: 3
      Change someone elses prompt to "". Drives them crazy until they figure it out.

      You can normally only do this if you have root access, or if they're careless enough to leave themselves logged on. If it's the latter, a favourite trick at University used to be to create a file called "*" in their home directory. The number of people that just did rm * to get rid of it is quite astonishing...

      --
      "The invisible and the non-existent look very much alike." -- Delos B. McKown
    2. Re:I good trick to play by PD · · Score: 4

      If they leave their system for just a minute, first send an e-mail to everyone in the company saying "This is Joe's computer. Joe left me logged in. Joe shouldn't have done that."

      Then, type echo "echo sleep 1 >> .profile" >> .profile

      Damn this system is getting slower every time I log in!

    3. Re:I good trick to play by rdejean · · Score: 4

      my favorite is to change their prompt to: PS1="Login incorrect\n\nlogin: "

    4. Re:I good trick to play by American+AC+in+Paris · · Score: 5
      Change someone elses prompt to "". Drives them crazy until they figure it out.

      Heh. Reminds me of the time that my best friend changed my cell phone banner to say, " *Ringer Off* ". You can imagine my frustration (and his amusement...)

      --

      Obliteracy: Words with explosions

  4. See my post on The Other Site by Phil+Gregory · · Score: 3

    Kuro5hin ran an article on shell prompts recently. Rather than retype everything ('cause I'm lazy), I'll just provide a link to my post about my prompt.


    --Phil (Still need to add APM stuff to my prompt.)
    --
    355/113 -- Not the famous irrational number PI, but an incredible simulation!
  5. 'leet color prompt by betaray · · Score: 4

    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"

  6. Simple: 0:hostname:~$ by Kaz+Kylheku · · Score: 3

    The one point of interest is the 0, which is the termination status of the most recently executed command. This is obtained from bash simply by inserting $? into the PS1 variable.

    I got this termination-status-embedding-in-prompt idea from Tanmoy Bhattacharaya.

    PS1=$?:\h:\w\$

  7. Command prompt? by grub · · Score: 4

    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

    --
    Trolling is a art,
  8. Re:WARNING: read this first before you cut'n'paste by Surak · · Score: 5

    Set a password on the nobody account and give it a shell... so you can log in.

    passwd nobody
    chsh nobody /bin/sh

    then telnet into your box:

    telnet 127.0.0.1

    login as nobody.
    Then they can put in all the exits they want and it won't make a diff, especially if you use something like ktelnet or gtelnet.

  9. prompt funk by weefle · · Score: 3

    Mine looks sorta like this, with some color added:

    -[hynfiecl@xenos:~]--- ---[2001/07/06-11:05:42]-
    $

    I have a pretty nasty script that hacks it together. I wrote it after reading the Bash Prompt HOWTO and visiting a Bash themes site that has since been haxx0red. There are more good example prompts, though, at this site. Here's my script, base 64 encoded (sorry, but uuencoding is not conducive to slashposting):

    IyEvYmluL2Jhc2gKCmZ1bmN0aW9uIF9wcm9tcHQgewoJbG9jYW wgICAgICBub25lPSJcWxtbMG1c
    XSIKCWxvY2FsICAgICBibGFjaz0iXFsbWzA7MzBtXF0iCglsb2 NhbCAgICAgIGJsdWU9IlxbG1sw
    OzM0bVxdIgoJbG9jYWwgICAgIGdyZWVuPSJcWxtbMDszMm1cXS IKCWxvY2FsICAgICAgY3lhbj0i
    XFsbWzA7MzZtXF0iCglsb2NhbCAgICAgICByZWQ9IlxbG1swOz MxbVxdIgoJbG9jYWwgICAgcHVy
    cGxlPSJcWxtbMDszNW1cXSIKCWxvY2FsICAgICBicm93bj0iXF sbWzA7MzNtXF0iCglsb2NhbCAg
    ICAgIGdyZXk9IlxbG1swOzM3bVxdIgoJbG9jYWwgICBka19ncm V5PSJcWxtbMTszMG1cXSIKCWxv
    Y2FsICAgbHRfYmx1ZT0iXFsbWzE7MzRtXF0iCglsb2NhbCAgbH RfZ3JlZW49IlxbG1sxOzMybVxd
    IgoJbG9jYWwgICBsdF9jeWFuPSJcWxtbMTszNm1cXSIKCWxvY2 FsICAgIGx0X3JlZD0iXFsbWzE7
    MzFtXF0iCglsb2NhbCBsdF9wdXJwbGU9IlxbG1sxOzM1bVxdIg oJbG9jYWwgICAgeWVsbG93PSJc
    WxtbMTszM21cXSIKCWxvY2FsICAgICB3aGl0ZT0iXFsbWzE7Mz dtXF0iCglsb2NhbCAgICAgICBy
    ZXY9IlxbG1s1bVxdIgoKCWxvY2FsIEg9JG5vbmUkYmxhY2sKCW xvY2FsIE09JEgKCWxvY2FsIEw9
    JE0KCWxvY2FsIFQ9JG5vbmUkZ3JleQoJbG9jYWwgUD0kVAoJbG 9jYWwgTj0kbm9uZQoKCWlmIFsg
    IiRESVNQTEFZIiA9ICc6MC4wJyBdCgl0aGVuCgkJbG9jYWwgRD 0ixCIKCQlsb2NhbCBBPSLaIgoJ
    CWxvY2FsIEI9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DEgICAyICAgMyAgIDQgICA1ICAgNiAgIDcgIC A4ICAgOSAgIGEgICBiICAgYyAg
    IGQgICBlICAgZiAKICAweDAwOiAKICAweDEwOiAKICAweDIwOi AgICAgICAhICAgIiAgICMgICAk
    ICAgJSAgICYgICAnICAgKCAgICkgICAqICAgKyAgICwgICAtIC AgLiAgIC8gCiAgMHgzMDogICAw
    ICAgMSAgIDIgICAzICAgNCAgIDUgICA2ICAgNyAgIDggICA5IC AgOiAgIDsgICA8ICAgPSAgID4g
    ICA/IAogIDB4NDA6ICAgQCAgIEEgICBCICAgQyAgIEQgICBFIC AgRiAgIEcgICBIICAgSSAgIEog
    ICBLICAgTCAgIE0gICBOICAgTyAKICAweDUwOiAgIFAgICBRIC AgUiAgIFMgICBUICAgVSAgIFYg
    ICBXICAgWCAgIFkgICBaICAgWyAgIFwgICBdICAgXiAgIF8gCi AgMHg2MDogICBcYCAgIGEgICBi
    ICAgYyAgIGQgICBlICAgZiAgIGcgICBoICAgaSAgIGogICBrIC AgbCAgIG0gICBuICAgbyAKICAw
    eDcwOiAgIHAgICBxICAgciAgIHMgICB0ICAgdSAgIHYgICB3IC AgeCAgIHkgICB6ICAgeyAgIHwg
    ICB9ICAgfiAgICAKICAweDgwOiAgIIAgICCBICAggiAgIIMgIC AgICAgICAgICAgICAgCiAgMHg5
    MDogICAgICAgiSAgIIogICCLICAgjCAgIAogIDB4YTA6ICAgoC AgIKEgICCiICAgoyAgIKQgICCl
    ICAgpiAgIKcgICCoICAgqSAgIKogICCrICAgrCAgIK0gICCuIC AgryAKICAweGIwOiAgILAgICCx
    ICAgsiAgILMgICC0ICAgtSAgILYgICC3ICAguCAgILkgICC6IC AguyAgILwgICC9ICAgviAgIL8g
    CiAgMHhjMDogICDAICAgwSAgIMIgICDDICAgxCAgIMUgICDGIC AgxyAgIMggICDJICAgyiAgIMsg
    ICDMICAgzSAgIM4gICDPIAogIDB4ZDA6ICAg0CAgINEgICDSIC Ag0yAgINQgICDVICAg1iAgINcg
    ICDYICAg2SAgINogICDbICAg3CAgIN0gICDeICAg3yAKICAweG UwOiAgIOAgICDhICAg4iAgIOMg
    ICDkICAg5SAgIOYgICDnICAg6CAgIOkgICDqICAg6yAgIOwgIC DtICAg7iAgIO8gCiAgMHhmMDog
    ICDwICAg8SAgIPIgICDzICAg9CAgIPUgICD2ICAg9yAgIPggIC D5ICAg+iAgIPsgICD8ICAg/SAg
    IP4gICD/IApFT0YKCXJldHVybgp9CgpfcHJvbXB0ICRURVJNCg ==
  10. Re:my net worth on the command line by [amorphis] · · Score: 3

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

  11. Bash Prompt Goodness by BuckshotJones · · Score: 5

    Check out http://www.shelluser.net/~giles/bashprompt/prompts /index.html for some really extravagent Bash prompts.

  12. TL1 geeks: My prompt is GR-253-CORE compliant! by Myself · · Score: 4

    7. If your prompt is
    ;

    RYLOMIMNK02 01-07-06 13:08:40
    M 0169 COMPLD
    ;

    Chances are good you draw lots of blank stares at parties from packet geeks who don't grok circuit switching. If you've ever replied "SNVS" to someone who bothered you while you were sleeping, or "PICC" to a telemarketer, you need to get out more, but I sympathize.

  13. Re:prompt by lizrd · · Score: 3
    If you've transferred to Linux recently and want to the the old C:\> look back you could try this one:

    PS1="C:\\ \w>"

    With a little bit of fancy bash work you could probably even get it to change to A:\> when pwd is /mnt/floppy or D:\> when pwd is /mnt/cdrom. If anyone has ideas let me know, I think that it's kind of cute.

    ________________________

    --
    I don't want free as in beer. I just want free beer.
  14. Yours looks EASY by blakestah · · Score: 3

    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\]$ '

    1. Re:Yours looks EASY by Drone-X · · Score: 5
      Color?? Excuse me for breathing, but I'm using a paper teletype and MAN it's hard enough to use Lynx on this thing without all the frilly escape codes.
      Using colors on the shell is quite useful if you telnet/ssh into other boxes. That way you can easily spot what computer you're working on and not screw up on the wrong computer :).
    2. Re:Yours looks EASY by CaptainZapp · · Score: 5
      Using colors on the shell is quite useful if you telnet/ssh into other boxes. That way you can easily spot what computer you're working on and not screw up on the wrong computer :).

      Rats! I can either mod you up (which your post is well worth of) or comment. A conflict of interest if I've ever seen one. %-:)

      Nevermind, you raise an extremely important point. In my professional work environment (where I tend to fuck around with big bastardized databases) my arse was saved more then once, by using this technique.

      I might get odd looks (hey, that yellow on red is totally HORRID!!!)

      But considering that such a horrid color setup definitely prevents me from issuing a DROP DATABASE CorporateCritical on the wrong telnet session is well worth the hassle

      --
      ich bin der musikant

      mit taschenrechner in der hand

      kraftwerk

  15. My Phone by Xenex · · Score: 5
    The logo on my mobile phone (a Nokia 6210) is

    [root@6210 /]#

    :-)

  16. if your prompt looks like.... by krokodil · · Score: 5

    If your command promt looks like:

    1. C:\>

    You are conservative person. It takes you
    some time to accept new techology

    2. #

    You are respected by colleagues and feared by enemies.

    3. joe@cube.some.com:~/joe[12:35 - Fri Jul 6]>
    You really like techology, like to learn new things, do not afraid to experiment. You going
    to move out of parents place soon.

    4. cube:/usr/src/kernel>

    With your 20 years if Unix experience you should have no problem finding new job.

    5. (Press ^D when you done with fsck)#

    Difficult times are ahead of you. Do not lose
    your courage and patience.

  17. How about this by dante101vr2 · · Score: 3

    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.

    --
    Putting the IT in Sh**
  18. 2 liner, if your into that sort of thing... by galihad · · Score: 3

    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 ";

    --
    -- galihad
  19. Re:WARNING: read this first before you cut'n'paste by lpontiac · · Score: 3
    What's going to stop someone from just putting "exit" into the commands run, thereby hosing your system?

    They're not keyboard macros, they're aliases. They don't matter outside of the current shell context... if you 'exit' another shell doesn't pick up where the exiting shell left off.

    Simple demonstration: try this

    bash
    alias blah="exit; echo hi; exit"
    blah

    You should notice that the echo and second exit don't actually ever get executed... it's like putting something straight after a return in a C program.

  20. Funny one I'm stealing from my lecturer... by lpontiac · · Score: 4

    # (bash syntax, alter appropriately. BTW, not intended for *your* .profile :)

    export PS1="\nYou are in a room with many doors, all alike\n# "

    alias cd="echo That door is locked"
    alias pwd="echo You are lost"
    alias ls="echo It is too dark to see anything"
    alias cat="echo It is too dark to see anything"
    alias vi="echo You\\'re not strong enough to perform that action"
    alias startx="echo I don\\'t understand"
    alias exit="echo You don\\'t know the way out"

    # And in case they try to remove their .profile...
    alias rm="echo I\\'m sorry Dave, I\\'m afraid I can\\'t do that"

  21. my net worth on the command line by bergeron76 · · Score: 3

    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?


    --
    Don't think that a small group of dedicated individuals can't change the world. It's the only thing that ever has.
  22. DOS Format C? by CritterNYC · · Score: 5

    I used to do this to unsuspecting DOS/Windows users:

    prompt $p$gformat c:

    This yields a prompt of:

    c:>format c:

    It scares the hell out of newbies.

  23. apple II prompts by xipho · · Score: 3

    10 input "]"; 20 get A$ 30 print "why would you want to do that?" 40 goto 10 ]save hello

    --

    only infrmatn esentil to understandn mst b tranmitd
  24. all evil by X-Dopple · · Score: 4

    [root@allevil]$

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

  25. Me vs. The Slashdot Filters by American+AC+in+Paris · · Score: 5
    Heh. I'd show ya my command line prompt...

    ...but it seems that it's too lame for Slashdot:

    Lameness filter encountered. Post aborted.

    Reason: Junk character post.

    Addendum: ...too much, too much! I tried to post the above, and got this as a response:

    Easy does it!
    This comment has been submitted already, 276231 hours , 34 minutes ago. No need to try again.

    I swear that I wasn't on the Internet then. Hell, I wan't even born back then...

    --

    Obliteracy: Words with explosions

  26. prompt by KupekKupoppo · · Score: 5

    c:\>

  27. Practical jokes by karmawarrior · · Score: 4
    I just modified a co-worker's ksh prompt which was something like:

    PS1="$PWD> "

    to

    PS1="
    Memory fault(coredump)^G
    $PWD>"
    (^G being the "beep" character.)

    While I was at it, I modified his MSDOS prompt to look similar to his Cygwin prompt, and his Cygwin prompt to:

    PS1="$(pwd -P | tr / \\\\)> "

    He comes back from vacation on Tuesday. Can't wait...
    --

    --
    KMSMA (WWBD?)
  28. WARNING: read this first before you cut'n'paste!!! by sofar · · Score: 5


    Some of the prompts posted in these threads will severely harm your system, a couple have already been spotted actually performing 'rm -rf /' or something else pretty bad.

    For the experts here: OK, some people need to find out the hard way

    For the newbies: read this:

    I've you're really lazy, open a shell, change to root and type 'su nobody', this way, you cannot harm you own system as bad as root or a normal user (although you might lose some unimportant stuff)...

    bit me!

  29. Only a geek by Violet+Null · · Score: 5

    For the longest time at home, my prompt was:

    It is very dark. If you continue, you are likely to be eaten by a grue.
    >