Forgot your password?
typodupeerror
It's funny.  Laugh.

What Does Your Command Prompt Look Like? 568

Posted by CmdrTaco
from the a-little-less-serious dept.
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>"

This discussion has been archived. No new comments can be posted.

What Does Your Command Prompt Look Like?

Comments Filter:
  • by Anonymous Coward
    get a life
  • by Anonymous Coward
    Do not run this command - it tries to change the permissions of your /etc directory (no, it did not succeed with me).
  • by Anonymous Coward
    Mmm... too much C++ and ZeroWing will do this to you...
    set prompt='All your argv[]s are belong to us: '
  • 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.
  • Hmm, in trying to post this, I came across a `lameness filter'. Probably a good idea in most situations, but this post contains a lot of the `junk characters' that it's complaining about. Maybe I just need to fill up some space with real words to offset whatever algorithm you guys are using to determine what shouldn't be posted.

    Also, there's the bashish theme engine thingy that some people should look at. I've seen some really amazing prompts (well, sort of -- they don't always work).

    In my /etc/bashrc:


    [ -f /etc/jjcolors ] && . /etc/jjcolors
    if [ "$EUID" = "0" ]; then
    PS1="$BRIGHT$BLUE[$RED\u$WHITE@\h$BLUE][$YELLOW\ w$ BLUE]$RED\\$ $NORMAL"
    else
    PS1="$BRIGHT$BLUE[$CYAN\u$WHITE@\h$BLUE][$YELLOW \w $BLUE]$CYAN\\$ $NORMAL"
    fi
    [ -f /etc/jjcolors ] && . /etc/jjcolors unset


    In my /etc/jjcolors:


    if [ "$1" = "unset" ];
    then
    {
    #
    # unset all:
    #
    unset BLACK RED GREEN YELLOW BLUE MAGENTA CYAN WHITE
    unset BGBLACK BGRED BGGREEN BGYELLOW BGBLUE BGMAGENTA BGCYAN BGWHITE
    unset BRIGHT NORMAL REVERSE BLINK UNDERSCORE
    }
    else
    {
    #
    # foreground colors:
    #
    BLACK='\[\033[30m\]'
    RED='\[\033[31m\]'
    GREEN='\[\033[32m\]'
    YELLOW='\[\033[33m\]'
    BLUE='\[\033[34m\]'
    MAGENTA='\[\033[35m\]'
    CYAN='\[\033[36m\]'
    WHITE='\[\033[37m\]'

    #
    # background colors:
    #
    BGBLACK='\[\033[40m\]'
    BGRED='\[\033[41m\]'
    BGGREEN='\[\033[42m\]'
    BGYELLOW='\[\033[43m\]'
    BGBLUE='\[\033[44m\]'
    BGMAGENTA='\[\033[45m\]'
    BGCYAN='\[\033[46m\]'
    BGWHITE='\[\033[47m\]'

    #
    # attributes:
    #
    BRIGHT='\[\033[01m\]'
    NORMAL='\[\033[00m\]'
    REVERSE='\[\033[07m\]'
    BLINK='\[\033[05m\]' # doesn't work in xterms
    UNDERSCORE='\[\033[04m\]' # only works in xterms

    # zzzzzz='\[\033[00m\]' # last env var
    }
    fi

    --
  • It occurs to me that the linux console and most xterms can switch in and out of a pseudo-vga mode where they can draw line characters to the screen using a standard iso8859-1 font. That's how `make menuconfig' and other menu-driven programs get line characters on the screen.

    To go into and out of this mode, use these:


    LINE='\[\016\]'
    UNLINE='\[\017\]'


    The letters `jklmnqtuvwx' correspond to different line characters when in this mode (well, single-line chars, at least).
    --
  • Heh, it's there. Slashdot's comment system just divided it into chunks, to prevent people from putting really long lines in and screwing up the tables.

    There should only be a single space in the prompt, between '\\$' and '$NORMAL'
    --
  • I use zsh, and I rather like having all of the information I need right on the command prompt. Many things only appear if they are needed (return values from programs for instance) and the prompt string avoids getting too long to leave me room to work my magic:
    %(!.%B#%b.)<%m/%l> %(?.%{%}.%B%?%b )(%h %B%(4c,.../%3c,%~)%b)%B:%b

    An average prompt looks like:
    <escaflowne/p7> (128 ~):
    A more interesting one:
    #<escaflowne/p7> 5 (2 .../X11R6/share/xmame):

    Down that path lies madness. On the other hand, the road to hell is paved with melting snowballs.
  • Oh yeah, this is at home. At work in the lab I make a slight modification:
    (int the .zshrc)
    HOSTTYPE=`uname`
    prompt="%(!.%B#%b.)<%m/$HOSTTYPE/%l> %(?.%{%}.%B%?%b )(%h %B%(4c,.../%3c,%~)%b)% B:%b "

    I did this because I was constantly forgetting what type of machine I was on, especially with the dual booters and the machines that changed OS all the time. Unfortunatly it make the prompt string a little longer than I normally like, but at least I didn't run killall on the Suns.

    Down that path lies madness. On the other hand, the road to hell is paved with melting snowballs.
  • I get strange looks from my friends for this one:

    setenv HOSTNAME `hostname | sed 's/\..*//' | tr \[a-z] \[A-Z]`
    set prompt = "C:\\"{$HOSTNAME}"> "

    (I switch between machines a lot, so it makes sense to use the hostname rather than the directory name.) However, it gets worse... I once knew a former mainframe guru whose UNIX prompt was configured to look like VM/CMS.
  • 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.

  • by Have Blue (616) on Friday July 06, 2001 @07:22AM (#103965) Homepage
    C:\> C:\spot> C:\spot>run run spot run!

  • This isn't really funny. I bet you're the type that watches America's Funniest Home Videos hoping to see someone get hurt.

    -Paul Komarek
  • Ksh will expand environment variables when it diplays, so you can do:

    PS1='$PWD$ '

    (Note the single quotes)

    -Dom
  • I can't post my .profile since I don't have one (I use .bashrc, etc), but it's not that interesting anyway ... the only interesting thing about it is that it's split up into a .bashrc (and .bash_login, etc) and .bashrc.local (and .bash_login.local, etc). The .local files are for local system settings, the rest are "generic" settings that should work under any *nix.

    The non-.local files are managed by CVS; my CVS repository is out there on the 'net on my private server, so from any 'net-connected *nix system with CVS, I can just CVS checkout my init files. Also whenever I change something on one system I can check it in and then update it on the other systems when I get to them.

    I even had the idea once of making this a sort of public service - setting up some simple scripts and programs as glue for managing the CVS side of things, and then putting a public CVS server up on the 'net just to allow people to check in their init files. Then someone could easily use this service to keep all of their init files up-to-date and consistent on every system they use.

    Actually, I am slowly working on some new OS ideas and one of my ideas is exactly this - a public (secure) repository for user configuration info so that whenever a user of the OS goes anywhere, their preferences can easily follow them.

    If anyone else wants to take this idea and run with it, be my guest.
  • by smartin (942) on Friday July 06, 2001 @07:24AM (#103972)
    Change someone elses prompt to "". Drives them crazy
    until they figure it out.
  • PS1='\w>'

    ---
    ticks = jiffies;
    while (ticks == jiffies);
    ticks = jiffies;
  • 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;
  • 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.
  • Ok, since this post actually elicited email response (which the Kuro5hin one didn't), I've put up a description of my prompt at http://www.geeksimplex.org/phil/prompt/ [geeksimplex.org]. Enjoy.



    --Phil (Yep, I'm replying to one of my own posts.)
  • Kuro5hin [kuro5hin.org] ran an article on shell prompts [kuro5hin.org] recently. Rather than retype everything ('cause I'm lazy), I'll just provide a link to my post about my prompt [kuro5hin.org].


    --Phil (Still need to add APM stuff to my prompt.)
  • by betaray (1268) on Friday July 06, 2001 @07:12AM (#103983) Homepage
    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"
  • by Kaz Kylheku (1484) on Friday July 06, 2001 @08:48AM (#103986) Homepage
    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\$
  • Bashprompt [current.nu], the original BASHISH [freshmeat.net] was cool. I helped the project a little, providing screen captures of the themes, and making a theme of my own [tasam.com] for bashprompt [gatech.edu]. Their server was recently cracked [current.nu], and they've run out of funding. Lets all pitch in and save this project. Mods: mod this one up please, thx

    da w00t.
  • yes, master? ~

  • rm -- -rf

    This only works with the rm in GNU fileutils. Traditional Unix rm mostly used

    rm - -rf
    Even that didn't work on all versions of Unix. The only way to be sure was to provide a path to the file:
    rm ./-rf
  • by Tet (2721) <slashdot&astradyne,co,uk> on Friday July 06, 2001 @07:54AM (#104001) Homepage Journal
    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...

  • 1. C:\>

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


    0. A>

    How did you managed to get the generator running all these year in this island? By the way, the Soviet Union disappeared.

    I received:
    This comment has been submitted already, 276325 hours , 47 minutes ago. No need to try again.
    __
  • Mine is fairly simple, but I like it. (I wonder if this will make it past the lameness filter.)

    export PS1='%B%m%(?..[%?])%(#.#.)%b '
    export PS2='%B%_%(#.#.)%b '
    export RPS1='%B%~:%*%b'

    Explanation:

    PS1 is the left-side prompt for normal commands, PS2 is for inside things like for & while loops. RPS1 is the right-side prompt for normal commands. All prompts are bold. PS1 is the machine name, the exit status (if non-zero) and then '#' if uid=0. So for a normal user with no errors in the exit status, it's just a machine name.

    PS2 lists the blocks I'm in (e.g., "for then" if I'm inside of an if block inside a for block). Then, if root, '#'.

    RPS1 is the tilde-encoded directory (e.g., '~' for home dir) followed by a ':', followed by the time.

    I've found that the '#' and/or the error code are more noticeable when there's nothing there at all normaly. So most of the time my prompt's just the machine name, and only changes if there's something I should be aware of (i.e., I have root or a command failed).

    Even better, though, is that I have "user@host:/dir" in my xterm (well, aterm, actualy) title bar:

    precmd () {print -Pn "\e]0;%n@%m:%~\a"}

    Great when I have a bunch of shells open and I'm looking through a menu for a particular shell session.
  • 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
  • As an admin, I need, mainly, two bits of information: who I'm logged in as and where. I just use something like PS1="%n:%m%# " (zsh syntax) which gives a login like jr:larien% or root:box# It means I can tell at a glance which system I'm logged into and as who, so I don't do something stupid as root (well, I'm less likely to!).

    For those not using zsh, you can use something like PS1="`whoami`:`hostname`% ".
    --

  • Back in the day, I had this leet-o prompt on my DOS box that was a little Texas flag made from an asterisk and a little high-ascii block. I wonder, first off, if any *nix terminal emulators will support all of those old ANSI drawing characters and if anyone still has this prompt lying around.

    BTW, remember ANSI bombs? heehee


    --
  • by Ed Avis (5917)
    You should read the Bash-Prompt HOWTO for more
    information.

    My prompt changes colour according to the
    logged-in user. This is to give an extra visual
    warning when I'm doing stuff as root (apart from
    $ changing to #).

    [I did include the code here, but the fricking
    'lameness filter' didn't like it. That
    thing really needs to be turned off for
    non-anonymous posts. Anyway, please look at
    <http://www.doc.ic.ac.uk/~epa98/.bashrc> for my
    prompt (roughly in the middle) and other fun
    stuff.]

    The prompt looks like

    eavis@m /usr $

    ie username@hostname current directory $

    in light blue (cyan). When root, it's red with
    the final character a #. When running as some
    other user, it turns orange.

    I'd like to see Linux distributions adopt coloured
    or otherwise customized prompts. Each user could
    have an ~/.prompt file or something. Easier than
    editing your .bashrc.

    Although actually Linux distros do a much better
    hob of making the prompt informative than the
    single character you get by default on many
    proprietary Unixes.
  • We remember where we are. The ultimate uebergeek command prompt is "# ". Uebergeeks also don't need fancy tty modes that display the characters we delete - we use "#" as a delete character.

    This is of course somewhat tongue-in-cheek - I use tcsh and my prompt tells me what machine I'm on - but the idea that hacking your prompt is geekitudinal is kind of silly. Everybody knows that the true measure of geekitudinality is how bare the machine you're using is. Real geeks use the ITS debugger as their command prompt. :')

  • by PD (9577) <slashdotlinux@pdrap.org> on Friday July 06, 2001 @08:25AM (#104044) Homepage Journal
    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!

  • ... puts the window name (from an env variable set at .xinitrc time), the machine name and the current dir at the window title, and prints a plain '$ ' as the prompt, or '# ' if i'm root. it also clears any bold mode or color, in case the previous program forgot to do so.

    PS1=$'%{\e[m\e]2; ['"$WINTITLE"$'] %m - %~ \a\e[m%}%(#.#.$) '

    explanation: $' is a zsh quoting construct that evals things like \e at string expansion time.

  • "\u@\h \w\$ "

    --

  • This puts my username, host and working directory in both my prompt and my xterm window title. Put it in /etc/profile on all machines you use and you always know where you are :) Only works if your shell is bash, though.

    case "$TERM" in
    xterm|xterm-*)
    PS1='`echo >&2 -en "\033]0;\u@\h:\w\007"`\u@\h:\w\$ '
    ;;
    *)
    PS1='\u@\h:\w\$ '
    echo "Non-xterm: window-title functions disabled"
    ;;
    esac
  • PS1=$'\\[\\033[1;34m\\]\\h\\[\\033[31m\\] = = = - - -\\n\\[\\033[0m\\]\\!:\\u:\\w>'

    Produces:

    machinename = = = - - -
    2218:username:~>

    The 2218 is the number of commands, make sure to increase the history amount.

    And the machine name is red, and the symbols after are blue.
  • You do know that if you're using bash, you can get the hostname up to the first . with \h, don't you?

  • by grub (11606) <slashdot@grub.net> on Friday July 06, 2001 @07:09AM (#104054) Homepage Journal

    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

  • Keep in mind that reusing the same dummy account all over the place may undermine the inherent security and other benefits of using that user. Each service should have its own dummy user (typically named after the service) so that cracking one service doesn't allow the intruder to affect other services. (Historical note: 'nobody' and 'nogroup' were created specifically to handle unrecognized uids/gids encountered by NFS-using systems. They were never intended to actually own any files or processes.)
  • You may also want to make a chroot jail. Make a temporary directory, (say, /test). Copy /bin to /test/bin, /lib to /test/lib, and /usr/lib to /test/usr/lib. Then "chroot /test bash" after loging into nobody.

    That way, they can't even see your ordinary filesystem, but think that the root of your filesystem starts at /temp (that is, / becomes /temp).

  • PS1='[\h:\w] \u$ '
    (Yes, it's the same as in OS X. I just happen to like it.)
  • PS1=$'\\[\\033[34m\\][\\[\\033[1;37m\\]\\@\\[\\033 [34m\\]]\\[\\033[32m\\]\\u\\[\\033[1;37m\\]@\\[\\0 33[31m\\]\\h\\[\\033[1;37m\\]:\\w\\[\\033[34m\\]>\ \ [\\033[0m\\]'

    I wonder if they disabled the lameness filter for this story...
  • set prompt="%{\033]0;%n@%m:%~\007%}"

    This puts the info for the current user@host:directory in the title bar.
  • It's times like this that i ask myself, why are we limited to just the ANSI colors in our xterms?

    Why not extend the terminal standard to support full RGB? The syntax could look like:

    \033[33;155;255R

    Then, for example, you could have a different colored prompt for each of your boxes. Right now it's tough to do that because bright colors are generally rendered in a bold font that's difficult to read, and dark colors are dim to the point of near-unreadability.

    What do you all think? Am i dumb or is this something you would use?

    --

  • Yeah, but then you have this problem [slashdot.org].

    BTW, i have a neat case .. esac statement to set the color and then a PROMPT_COMMAND to check the result of the last command you typed, and print out the result code, unless it's been printed before (i.e. if you type "ls asdfasdf" and then hit enter three times, it only prints it once)

    I'd love to paste the code, it's pretty neat, but apparant Slashdot's braindead filters thinks it's too lame.

    If you're interested, email me. Here's a screenshot:
    [~]$ true
    [~]$
    [~]$
    [~]$ false
    [~] (1) $
    [~]$
    [~]$

    --

  • 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.
  • set prompt="%{^[[1;32;40m%}%t-%n@%m\n%/%{^[[0;37;40m%} > "
  • Bah. I prefer the Keep It Simple Stupid approach. No color, no fancy-ass highlighting, just when and where I am.

    export PS1='\n|\t \d|\n\h:${PWD#${HOME}/}($?)> '

    which looks like

    |11:05:49 Fri Jul 6|
    escaflowne:/home/taliesin(0)>

    (which is: a newline, to separate itself from the garbage above it, date and time surrounded by pipes, another newline to avoid the prompt getting excessively long, short hostname, colon, working directory, return code in parens, right caret, space.)

    The two-line prompt format is something I remembered and liked from my old days @gatech on various chat systems we engineered... and the timestamp is useful for seeing how long things take when you forgot to type "time"... including how long you were gone to lunch or some such :) As for all the mail/user/group stuff, that's what "id" and kbiff are for... and no color, because I occasionally use a dummy terminal to check mail (where I don't _need_ kbiff). Platform independent, obvious (except for the retcode), and useful. Suits me.

    (Oh, the fiddly bit with HOME vs. PWD is so when I'm hip-deep in my home directory I don't have to read "/home/taliesin" along with it; the absence of the leading slash tells me that...)

    --
    No one would remember the Good Samaritan if he'd
    only had good intentions. He had money as well.
    -- Margaret Thatcher

  • by weefle (22109) on Friday July 06, 2001 @07:30AM (#104093)

    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 [linuxdoc.org] and visiting a Bash themes site [current.nu] that has since been haxx0red. There are more good example prompts, though, at this site [shelluser.net]. Here's my script, base 64 encoded (sorry, but uuencoding is not conducive to slashposting):

    IyEvYmluL2Jhc2gKCmZ1bmN0aW9uIF9wcm9tcHQgewoJbG9jYW wgIC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DEwOiAKICAweDIwOi 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 ==
  • Mine fiddles with my Xterm's title bar so it says "Terminal (user@host)". Great so you don't try to "sudo halt" your server by accident.

    I was going to post it here, but the /. lameness filter flags it as random characters. It's from the BASH Prompt HOWTO [linuxdoc.org], section 5 [linuxdoc.org], slightly modified.

    Greg

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

    Bingo :8)
    ~Tim
    --
    .|` Clouds cross the black moonlight,
  • by Aqualung (29956)
    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

  • 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...
  • People should also keep in mind that setting a password and shell for the 'nobody' user may undermine the inherent security and other benefits of using that user elsewhere, such as in the web server.
  • Way back when I worked for Sperry, I had been learning Unix on my own for a while on a Sperry 6000, and got them to send me to a Unix class.

    The class was kind of low-level the first day, stuff I already knew, and out of boredom, I set my prompt to "# ", just getting what idle amusement was available at the moment.

    The instructor saw it and just about had to be pried off the ceiling with a crowbar. It took nearly five minutes to convince him that I had not cracked root.

    Today, my prompt at work(csh) is

    set prompt="! `uname -n` ../$cwd:t > "

    command history number, host name, and the last part of the current directory. (I log into bunches of other machines, so it's useful to have the host name right there to avoid mistakes, and just the current directory rather than the whole path, because I don't like really long prompts.)

  • READY


    ("Lameness filter encountered. Post aborted." ?! Slashdot is probably run by C64 bigots!)
  • try:
    export PS1="$PS1""rm -rf"

    that'll give a good scare to a unix user :)

    -Mike

    (e.g.
    nameprotected.dyndns.org:~ 12:41:08->

    becomes

    nameprotected.dyndns.org:~ 12:41:08-> rm -rf
    )
  • prompt $e[s$e[0;64H$e[P7$d$e[1;68H$t$e[P0$e[u$P$G

    Save cursor position
    Move to r0 c64
    reverse video
    echo current date
    move to r0 c68
    echo current time
    normal video
    restore cursor position
    echo path
    echo close bracket
    ---

  • by [amorphis] (45762) on Friday July 06, 2001 @07:07AM (#104137)
    gives new meaning to the term "bottom line" :-)
  • Even better: also create a file named -rf to go along with it. Ironically, the -rf file will be the only one that won't be wiped...
  • set prompt=("%n@%m:%/ {%!} ")

    tcsh...

  • by BuckshotJones (48985) on Friday July 06, 2001 @07:25AM (#104142)
    Check out http://www.shelluser.net/~giles/bashprompt/prompts /index.html [shelluser.net] for some really extravagent Bash prompts.
  • READY.

    heh... favorite routine to jump to:
    SYS 64738
  • by Myself (57572) on Friday July 06, 2001 @09:19AM (#104150) Journal
    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.
  • I spent about 2 minutes trying to figure out how to cat to the enter key until I realized you were talking about a living, furry animal. -Matt
  • export TERM_DEVICE=`tty | cut -d/ -f 3-`
    if [ "$TERM" = "xterm" ]; then
    PS1='\[^[]0;\h:\w [$TERM_DEVICE] [`whoami`]^G\]\h:\w\$ '
    else
    PS1='\h:\w\$ '
    fi

    You'll need to convert the ^[ and ^G characters to actual escape characters. Control-V, and then the character (escape or g) for the unititiated. Or, you could use the \xxx method but I'm too lazy to convert to octal.

    This probably will only work correctly with bash.

    After I'm done with prompt stuff and setting up my CVS environment, I make sure to issue a:

    ulimit -c unlimited

    so that my machine dumps core.

  • I did... EMM386 was pretty good for that, but usually it took Windows 3.x to get the ball rolling.
  • New job, no Unix. But my old KSH prompt was thus:

    .profile:

    export NEST=0
    export HOST=`hostname`

    .kshrc:

    NEST=$(expr $NEST + 1)
    export PS1='[${HOST}:${PWD}:N${NEST}] '


    At one point I also got the current time in there, but the prompt got too long. Note, it's
    been a while, the quoting syntax on PS1 may be off...

  • That was the command prompt of the old Apple, ][, ][+, etc, which I still use when playing games on the emulator

    And $p] when on a PC. :)

  • DOS had a built in path length limit. It wouldn't let you cd beyond that length. But you could still mkdir onemore. mkdir onemore\onemore. mkdir onemore\onemore\onemore. Pretty soon DOS crashes.

  • 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.
  • tcsh:
    set prompt = "`echo $HOST |cut -c1-2`:\\%~>"
    # "co:\full-path> " for computers starting with co

    bash:
    PS1="[\u@\h \W]\$"

    -Michael
  • by iceT (68610)
    Like NEWBIES know what a command prompt is...

    They're probably still looking for the 'Start' button...
  • #
    # Setup the prompt
    #
    if (! $?STY) then
    set prompt="[%l]%S%m:%s%c3/%S[%t]%s:"
    else
    set TTY = `echo $STY|cut -d. -f2`
    if ($?PROMPT) then
    set prompt="$PROMPT"
    else
    set prompt="[%l]%S%m($TTY\:S.$WINDOW):%s%c3/%S[%t]%s:"
    endif
    endif


    Which looks like:
    • [ttya2]beaker(ttyp1:S.3):~/[12:48pm]:
    And here at work, the idiots set the prompts to:
    PROMPT=$D $T$_$P$G

    Which looks like:
    • Fri 07-06-2001 12:43:40.71
      C:\>
  • by lizrd (69275)
    On my laptop I like to set $PROMPT_COMMAND to run apm before displaying my prompt. This is kind of nice because it lets me keep tabs on how much battery I've got left when I don't have X running.

    ________________________
  • by lizrd (69275) <adam&bump,us> on Friday July 06, 2001 @07:30AM (#104172) Homepage
    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 manage several dozen oracle servers on about a dozen solaris/hpux/linux boxes, so I always like to know who/what/where I am:

    echo $PS1
    $LOGNAME@$HOSTN [$PWD]:

    my prompt looks like:
    oracle@workmachine [/opt/oracle]:
    ---
    Interested in the Colorado Lottery?
  • by blakestah (91866) <blakestah@gmail.com> on Friday July 06, 2001 @07:08AM (#104207) Homepage
    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\]$ '
  • by Xenex (97062) <<xenex> <at> <opinionstick.com>> on Friday July 06, 2001 @08:56AM (#104215) Journal
    The logo on my mobile phone (a Nokia 6210) is

    [root@6210 /]#

    :-)

  • by krokodil (110356) on Friday July 06, 2001 @07:31AM (#104239) Homepage
    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.

  • by dante101vr2 (144352) on Friday July 06, 2001 @07:09AM (#104299) Homepage
    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.
  • by Drone-X (148724) on Friday July 06, 2001 @08:02AM (#104306)
    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 :).
  • by rdejean (150504) on Friday July 06, 2001 @08:47AM (#104308) Journal
    my favorite is to change their prompt to: PS1="Login incorrect\n\nlogin: "
  • by galihad (150973) on Friday July 06, 2001 @07:04AM (#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 ";
  • by lpontiac (173839) on Friday July 06, 2001 @09:01AM (#104333)
    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.

  • by lpontiac (173839) on Friday July 06, 2001 @08:49AM (#104334)
    # (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"

  • by bergeron76 (176351) on Friday July 06, 2001 @07:05AM (#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?


  • by CaptainZapp (182233) on Friday July 06, 2001 @09:05AM (#104344) Homepage
    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

  • by CritterNYC (190163) on Friday July 06, 2001 @08:10AM (#104352) Homepage
    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.
  • by xipho (193257) on Friday July 06, 2001 @11:22AM (#104355)
    10 input "]"; 20 get A$ 30 print "why would you want to do that?" 40 goto 10 ]save hello
  • by X-Dopple (213116) on Friday July 06, 2001 @07:10AM (#104380)
    [root@allevil]$

    Yes, my machine is named 'allevil' and I am the root of it.
  • by American AC in Paris (230456) on Friday July 06, 2001 @07:41AM (#104407) Homepage
    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...

  • by American AC in Paris (230456) on Friday July 06, 2001 @07:45AM (#104408) Homepage
    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...)

  • by KupekKupoppo (266229) on Friday July 06, 2001 @07:03AM (#104448)
    c:\>
  • by karmawarrior (311177) on Friday July 06, 2001 @10:17AM (#104456) Journal
    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...
    --


  • 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!
  • by Violet Null (452694) on Friday July 06, 2001 @08:12AM (#104489)
    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.
    >

"Floggings will continue until morale improves." -- anonymous flyer being distributed at Exxon USA

Working...