MakeTechEasier
  • Home
  •  
  • About
  •  
  • Archives
  •  
  • Jobs
  •  
  • Advertise
  •  
  • Contact Us
  • Windows
  • Linux
  • Mac
  • Internet
  • WordPress
  • iPhone
  • Android
  • All Categories
    • Android RSS
    • Firefox RSS
    • Gaming RSS
    • Google RSS
    • google chrome RSS
    • Internet RSS
    • iPhone/iPod Touch RSS
    • Linux RSS
    • Mac RSS
    • Mobile RSS
    • OpenOffice RSS
    • PC Hardware RSS
    • Review RSS
    • Roundup RSS
    • Windows RSS
    • Windows Mobile RSS
    • WordPress RSS
    • WordPress Plugins RSS
  • rss icon
  • email icon
  • facebook icon
  • twitter icon

8 Useful and Interesting Bash Prompts

Posted by: Joshua Price on September 4th, 2009
  • 79 Comments
  • Share

bachprompts-mainMany people don’t think of their command prompt as a particularly useful thing, or even pay it much attention. To me, this is a bit of a shame, as a useful prompt can change the way you use the command line. Well I’ve scoured the Interwebs looking for the best, most useful, or sometimes most amusing bash prompts. Here, in no particular order, are the ones I’d be most likely to use on my computers.

Note – to use any of these prompts, you can copy & paste the “PS1=” line directly into your terminal. To make the change permanent, paste the line to the end of your ~/.bashrc file.

1. Show Happy face upon successful execution

This prompt is probably the most amusing one on the list, but remains useful. The idea is that as long as your commands execute successfully, your prompt shows a happy face. Any time a command fails, it shows a sad face instead.

Example:
bashprompts-happyface
Code:

PS1="\`if [ \$? = 0 ]; then echo \[\e[33m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi\`[\u@\h:\w]\\$ "

2.Change color on bad command

Here’s one of my favorites. This prompt has it all. Like above, the prompt changes color if your last command failed to run successfully, but it also shortens long paths and contains the bash history number of each command for easy retrieval.

Example:
bashprompts-hurring
Code:

PROMPT_COMMAND='PS1="\[\033[0;33m\][\!]\`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"'

3. Multi lines prompt

If you’re the type who wants to pack your prompt full of information, then here’s the one for you. This one is a multi-line prompt containing date/time, full path, user and host, active terminal, even file count and space usage.
Example:
bashprompts-informant
Code:

PS1="\n\[\033[35m\]\$(/bin/date)\n\[\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\]"

4. Color manage your prompt

There’s nothing particularly fancy about this prompt, other than the good use of color to separate the different pieces of information. As you can see, it provides time, username, hostname, and current directory. Fairly minimal but useful.

Example:
bashprompts-4
Code:

PS1="\[\033[35m\]\t\[\033[m\]-\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "

5. Show full path

This one’s a nice, clean, minimal 2-line prompt (plus a blank line at the top). You’ve got your full path at the first line and pretty much just the username at the bottom. If you want to remove the blank line at the start of every prompt, just take out the first “\n”.

Example:
bashprompts-5

Code:

PS1="[\[\033[32m\]\w]\[\033[0m\]\n\[\033[1;36m\]\u\[\033[1;33m\]-> \[\033[0m\]"

6. Show background job count

Another nifty 2-liner, but this one’s got some info we haven’t used before. The first line is the normal user@host, with full path. On the second line we’ve got history number and a count of the jobs running in the background.

Example:
bashprompts-6

Code:

PS1='\[\e[1;32m\]\u@\H:\[\e[m\] \[\e[1;37m\]\w\[\e[m\]\n\[\e[1;33m\]hist:\! \[\e[0;33m\] \[\e[1;31m\]jobs:\j \$\[\e[m\] '

7. Display directory information

A very elegant and nice looking prompt design. With this one we’ve got user/host, number of jobs, and date/time on the top line. Below that is current directory along with number of files in that directory and their disk usage.

Example:
bashprompts-7

Code:

PS1="\n\[\e[30;1m\]\[\016\]l\[\017\](\[\e[34;1m\]\u@\h\[\e[30;1m\])-(\[\e[34;1m\]\j\[\e[30;1m\])-(\[\e[34;1m\]\@ \d\[\e[30;1m\])->\[\e[30;1m\]\n\[\016\]m\[\017\]-(\[\[\e[32;1m\]\w\[\e[30;1m\])-(\[\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[30;1m\])--> \[\e[0m\]"

8. My Prompt

And finally, the prompt I personally like to use. It’s a modification of #7, changed to take up less space and include only the information I most want in my prompt. I like the two-line style as it lets me see the full path without reducing the space for my actual commands.

Example:
bashprompts-8
Code:

PS1="\n\[\e[32;1m\](\[\e[37;1m\]\u\[\e[32;1m\])-(\[\e[37;1m\]jobs:\j\[\e[32;1m\])-(\[\e[37;1m\]\w\[\e[32;1m\])\n(\[\[\e[37;1m\]! \!\[\e[32;1m\])-> \[\e[0m\]"

If you’d like to share your prompt, please do so in the comments below.


Josh Price is a Linux professional and contributing writer to MakeTechEasier.com

Tags: bash, Linux, prompt, shell
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Share and Enjoy!

  • Rss feed
  • StumbleUpon It!
  • Del.icio.us
  • reddit

Related Posts

  • Making The Linux Command Line A Little Friendlier
  • Transform Kubuntu Jaunty to Windows 7 In 3 Simple Steps
  • How to Install Software from a Tarball in Linux
  • Backing Up Data In Ubuntu Using sBackup
  • How to Run Multiple Linux Distros Without Virtualization

Popular Posts

  • Turn Your Ubuntu Hardy to Mac OSX Leopard 498 comment(s)
  • Turn Your Ubuntu Intrepid Into Mac OSX Leopard 311 comment(s)
  • 28 Coolest Firefox About:Config Tricks 122 comment(s)
  • How To Boot And Install Windows 7 From USB Flash Drive 122 comment(s)
  • Best 101 Free Computer Software For Your Daily Use 101 comment(s)

Enjoyed the article? Subscribe to Make Tech Easier today to get your daily updates of technology tutorials, tips and tricks.

Enter your email:

29 pingbacks/trackbacks (Click to open)

  • Eustáquio Rangel (taq) 's status on Friday, 04-Sep-09 14:53:31 UTC - Identi.ca
  • Take command of your BASH prompt - Hack a Day
  • Take command of your BASH prompt | Mobile Jewels
  • 8 Useful and Interesting Bash Prompts – Make Tech Easier « Netcrema – creme de la social news via digg + delicious + stumpleupon + reddit
  • links for 2009-09-05 .:: [aka ????????] Ozver.in | ???????
  • Take command of your BASH prompt | Diy all the Way
  • DöööDööö» Blogarchiv » Kommandozeile Bunt machen
  • GoblinX Project » GoblinX Newsletter, Issue 216 (09/06/2009)
  • All Teched Up « Caintech.co.uk
  • 8??????Bash????? | ?? - CoolShell.cn
  • 8 Useful and Interesting Bash Prompts – Make Tech Easier | Perculaclowns Blog
  • Scott Nesbitt (scottnesbitt) 's status on Monday, 07-Sep-09 22:04:12 UTC - Identi.ca
  • NexNova » Blog Archive » Links del giorno: September 8, 2009
  • Luis Ángel Fernández Fernández (lafdez) 's status on Tuesday, 08-Sep-09 06:40:16 UTC - Identi.ca
  • lostson (lostson) 's status on Tuesday, 08-Sep-09 10:19:46 UTC - Identi.ca
  • Interesting bash prompts « ejes consulting
  • De ideale BASH-prompt « NLLINUX
  • Shroom.com » Blog Archive » bash prompt fun
  • More Light! More Light! :: links for 2009-09-09
  • Hacer útil el prompt de bash
  • Links for 10th September 2009 | Velcro City Tourist Board
  • Destillat KW37-2009 | duetsch.info - GNU/Linux, Open Source, Softwareentwicklung, Selbstmanagement, Vim ...
  • [StumbleUpon] 8 Bash Prompts utili e interessanti | Senza categoria
  • Interessante Links - Tom Schimana
  • Paul Gysler (hammerandbank) 's status on Monday, 19-Oct-09 18:17:50 UTC - Identi.ca
  • Und da war da noch… 2009-12-05 « h t t p : / / m a l i s o n . o r g
  • XoIN’s Blog » 10 leuke en handige dingen op het internet
  • Add updated weather to your BASH prompt | geek.phatus.com
  • How to Save and Share Bash Settings Using Pastebin – Make Tech Easier
[Click to close]

79 Responses

  • EllisGL says:
    September 4, 2009 at 12:09 pm

    Now how do you show the extended char set via a mingetty sshd session?

    Reply
    • EllisGL says:
      September 4, 2009 at 3:30 pm

      Oh how to get it to work in putty?

      Reply
    • ellisgl says:
      September 7, 2009 at 9:49 pm

      I’m sure it’s something with the RHEL 5 environment and the encoding it’s sending. Any ideas? I’ve gone a bunch of LANG and TERM settings on the server side…

      Reply
  • Greg says:
    September 4, 2009 at 11:21 pm

    Great stuff, I like the concepts behind all of them, think I might try out the happy face!

    In the future though, you should use png for images of text, instead of jpg. They’ll look a lot cleaner.

    Reply
  • Craig says:
    September 4, 2009 at 11:50 pm

    Nice, thanks!

    I accidentally leave stuff backgrounded a bit often, so I’ve used the jobs concept above to get it to OPTIONALLY report the bg jobs if there are any..

    PROMPT_COMMAND=’PS1=”${debian_chroot:+($debian_chroot)}\[33[01;32m\]\u@\h\[33[00m\] \[33[01;34m\]\W\[33[00m\] `if [ $(jobs | wc -l | tr -d " ") -gt 0 ]; then echo “\[\e[1;31m\]jobs:\j\[\e[m\]“; fi` \$ \e]30;\h\a”‘

    craig@homei7 tmp jobs:1 $
    craig@homei7 tmp jobs:1 $ fg
    vi /tmp/tmp1
    craig@homei7 tmp $

    Reply
    • Joshua Price says:
      September 7, 2009 at 1:23 am

      Thanks for the suggestion Craig.

      For anyone wanting to try Craig’s prompt, there’s a minor annoyance when posting these kinds of codes where any instance of “backslash zero” gets filtered out, so all cases of “\[33″ should actually be “\[\ 033″ (extra space added to make sure it doesn’t happen on this reply)

      Reply
  • robb says:
    September 5, 2009 at 9:34 am

    LOL smiley command.
    nice one.

    Reply
  • Zilioum says:
    September 5, 2009 at 1:47 pm

    How can I get rid of those commmands again (don’t worry, I like them, but I like to know how to uninstall something before I install it)
    Cheers

    Reply
    • seventoes says:
      September 5, 2009 at 6:10 pm

      If you don’t put it in your .bash_profile or .bashrc file, it won’t load during your next session, so just close the window. Otherwise, just remove it from the file you put it in.

      Reply
      • Joshua Price says:
        September 7, 2009 at 1:24 am

        Right, if you paste one of these in your terminal without saving in something like .bashrc it will go away next time you open your terminal. You can also type “source .bashrc” to restore the default prompt.

        Reply
  • Zilioum says:
    September 5, 2009 at 1:48 pm

    found out. sry, didnt read the all of the first paragraph.

    Reply
  • mike says:
    September 5, 2009 at 8:49 pm

    http://slashdot.org/comments.pl?sid=108424&cid=9219400

    this is the earliest reference i can find

    Reply
  • mike says:
    September 5, 2009 at 8:50 pm

    http://slashdot.org/comments.pl?sid=108424&cid=9219400

    this is the earliest version i can find.

    Reply
  • Cygal says:
    September 6, 2009 at 3:56 am

    My zsh prompt is quite small.

    PROMPT=’%~> ‘
    RPROMPT=’%T’

    Displays the canonical path on the left, and the time on the right. If the command is too long, the time is removed.

    ~> cd ../ 9:56
    /home> 9:56

    Reply
  • jrglasgow says:
    September 6, 2009 at 11:10 am

    PS1=”\[33[01;32m\]\u@\h\[33[01;34m\] \w \[33[00m\]\$(git branch 2>/dev/null | grep ‘^*’ | colrm 1 2)\[33[01;34m\] \$\[33[00m\] ”

    The interesting thing about my prompt is the git repository branch is named in the prompt

    Reply
    • Joshua Price says:
      September 7, 2009 at 1:26 am

      Thanks, I had considered adding a nice git prompt I found but didn’t think all that many people would be interested so I’m glad someone added it in comments.

      Also, for other readers of jrglasgow’s comment, see the comment above regarding broken escape codes

      Reply
  • Alexander Fairley says:
    September 6, 2009 at 12:47 pm

    What do I need to do to get the lovely interstitial characters on prompt 7 to display?

    Reply
    • Joshua Price says:
      September 7, 2009 at 1:28 am

      I had mixed success with that. Initally it worked perfect for me in xterm and wterm, but looked broken in gnome-terminal. After I tinkered with it, it no longer looked right in any term!

      I would suggest seeing if it looks correct in another terminal (like xterm or wterm)

      Reply
  • mark says:
    September 6, 2009 at 2:20 pm

    People seem to be happy, so I will be the first to say that those prompts are horribly ugly.

    Bash is ugly!

    PS: Zsh is not that much more beautiful but the RPROMPT really is damn cool.

    Reply
  • Travis says:
    September 6, 2009 at 6:14 pm

    Lol, #1 is definitely my favorite!

    Reply
  • Volkan YAZICI says:
    September 6, 2009 at 6:22 pm

    Check this out: http://www.students.itu.edu.tr/~yazicivo/files/lpsconf.sh

    Reply
  • Jedediah Smith says:
    September 6, 2009 at 7:01 pm

    Find here my bash prompt that displays git branch and changed files:
    http://code.extension.ws/post/181469611/git-prompt-rb

    Reply
    • Joshua Price says:
      September 7, 2009 at 1:33 am

      Running a ruby script for each prompt display is pretty bold =)

      It is a nice prompt though!

      Reply
  • Michael says:
    September 7, 2009 at 1:07 am

    OK, so after dinking around for a while — I’ve come up with one I like. I’d be even happier if I could figure how to get the line characters to work (like in #7)…

    Anyway, this one is based on parts of #1 and #7. It has user@machine, timestamp and directory one one line — and job count, a success/failure indicator (a green :-) on success or a red :-( on failure) on the second line. followed by a $

    PS1=”\n\[\e[30;1m\](\[\e[34;1m\]\u@\h\[\e[30;1m\])-(\[\e[34;1m\]\t\[\e[30;1m\])-(\[\[\e[32;1m\]\w\[\e[30;1m\])\[\e[30;1m\]\n(jobs:\[\e[34;1m\]\j\[\e[30;1m\])\`if [ \$? -eq 0 ]; then echo \[\e[32m\] \:\-\); else echo \[\e[31m\] \:\-\( ; fi\`\[\e[0m\] $ ”

    # Now I must get some work done :-)

    Reply
    • Joshua Price says:
      September 7, 2009 at 1:35 am

      Perhaps it didn’t paste right, it’s invalid when I try to test.

      As noted in comments above, bash codes don’t always display correctly, not sure if it’s our CMS or some browsers or what. If you’ve got a link to a plain text version or something, please share.

      Reply
    • Michael says:
      September 7, 2009 at 1:53 am

      Thanks to Joshua Price’s reply above, I can reduce the frustration level of anybody wanting to try the PS1 I posted — by providing a link to a non-mangled version:

      http://media.stray-hound.com/prompt.sh

      Reply
    • rexmo says:
      September 9, 2009 at 1:36 am

      bash: syntax error near unexpected token `\[\e[34′

      Reply
  • Maertin says:
    September 7, 2009 at 6:42 pm

    After reading this i took the time to make my promt, and remembered why i am using zsh.
    even though zsh syntax is easier to read i took the idea from one of the /. replies and made this file which i then source from .zshrc
    ————————setpromt-zsh———————–
    RESET_COLOR=”%f”
    COLOURED_RETURN_VAL=”%(?,%F{green},%F{red})(%?)”
    SHORT_PWD=”%3~”
    ROOT_OR_NOT=”%#”
    WHITE=”%F{white}”

    # Throw it all together
    PROMPT=”${COLOURED_RETURN_VAL}${WHITE}${SHORT_PWD}${ROOT_OR_NOT}>${RESET_COLOR}”
    RPROMPT=”%F{yellow}%T%f[%!]”
    —————————–EOF————————-

    gives me this
    (0)~%> 0:36[3081]
    (0)~%>return 123 0:37[3081]
    (123)~%> 0:37[3082]

    you can’t see the colors here
    but the return number turns red when not zero

    Reply
  • Amit Agarwal says:
    September 7, 2009 at 10:45 pm

    I use bashstyle for this purpose.
    http://blog.amit-agarwal.co.in/2009/06/17/bashstyle-rpm-for-fedora-11-style-up-your-bash-prompt/

    Reply
  • David says:
    September 7, 2009 at 11:35 pm

    I just found this article and decided to piece together from what I could figure out from these examples

    PS1=”\[\e[37;1m\]-{\[\e[34;1m\]\u@\h\[\e[37;1m\]}-\n\[\e[37;1m\](\[\e[34;1m\]\w: \$(/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[37;1m\])\n–> \[\e[0m\]”

    It’s a three line prompt. Name and host at the top, directory in the middle and prompt on the last line.

    Reply
  • Raymond says:
    September 8, 2009 at 4:56 am

    It is basically imbecile to put terminal-dependent escape sequences into prompts. For some reason terminfo and termcap were invented.

    Raymond

    Reply
  • Raymond says:
    September 8, 2009 at 4:58 am

    Use termcap or terminfo for escape secuences.

    Reply
  • maciek says:
    September 8, 2009 at 9:39 am

    My favorite is: PS1=’C:${PWD//\//\\\}>’

    Which looks like this:
    C:\home\maciek\>

    Reply
    • John Anderson says:
      September 16, 2009 at 9:04 am

      That’s just sick. LOL! :)

      Reply
  • Dave says:
    September 8, 2009 at 10:14 am

    Regarding the line characters ? and ? in #7

    They are from the Microsoft cp437 codepage but have been mapped to unicode.
    See: http://en.wikipedia.org/wiki/Cp437

    So as long as you are using a utf-8 enabled terminal (the default on most modern distros) – and your terminal fonts are set up correctly – you can just copy and paste them.

    PS1=”\n\[\e[30;1m\]?(\[\e[34;1m\]\u@\h\[\e[30;1m\])-(\[\e[34;1m\]\j\[\e[30;1m\])-(\[\e[34;1m\]\@ \d\[\e[30;1m\])->\[\e[30;1m\]\n??(\[\e[32;1m\]\w\[\e[30;1m\])-(\[\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[30;1m\])–> \[\e[0m\]”

    Note: There is superfluous “\[” after the first dash on the second line in the original code given above.

    Reply
    • Dave says:
      September 8, 2009 at 10:25 am

      Ha ha…
      They don’t show up here either…
      Just replace the ?s in the line I gave above with the appropriate characters copied from http://en.wikipedia.org/wiki/Cp437

      Also, you can generate them directly in your terminal with:
      echo -e “\xe2\x94\x8c”
      echo -e “\xe2\x94\x94″
      And I used a long dash
      echo -e “\xe2\x94\x80″ which looks better in most terminals.

      Reply
  • Chris Adams says:
    September 8, 2009 at 10:20 am

    Continuing the version-control discussion, I posted the bash function which displays the current branch for Git, Mercurial, Subversion and even RCS:

    http://improbable.org/chris/index.php?ID=227

    Reply
  • bits of info says:
    September 9, 2009 at 10:52 am

    This is awesome!

    Reply
  • Vide says:
    September 9, 2009 at 12:00 pm

    The #7 is *really* expensive resources wise if used in any server environment. Use it with caution and carefully or you may be in trouble someday when less expected (although an unset PS1; exec bash will solve your problem)

    Reply
  • Jeremiah Altepeter says:
    September 10, 2009 at 6:53 pm

    I use a multi line prompt that begins with a # as such:

    PS1=”\n#–[\[\e[1;36m\]\u@\h\[\e[m\]]-[\[\e[1;34m\]\w\[\e[m\]]-[\$(date +%k:%M)]–>\n”

    This prompt displays as:

    #–[user@host]-[/path/to/working/dir]-[13:46]–>
    (with the cursor being down here on a new line)

    This prompt gives me (IMHO) the most important info at a quick glance, what machine I’m on, where I am in it, and the times each of my commands started and finished.

    The real treat in this prompt, is that I can copy a whole screen worth of terminal and just paste it into a shell script with no editing necessary: the # at each prompt line comments it out!

    Try it, you’ll like it, or your money back!

    Reply
    • Joshua Price says:
      September 10, 2009 at 8:04 pm

      I had considered putting something like that in the article originally, but couldn’t think of a good way to demonstrate the point with screenshots. Thanks!

      Reply
  • Ivan Andrus says:
    September 11, 2009 at 6:47 am

    Another (superior IMHO) way to allow copy/paste of a whole line is a prompt that looks something like

    : your info here ;

    e.g.

    : /path/[vc rev] : exit status ;

    because the : is the bash command that does nothing and the ; terminates that command and allows your command to execute. I use it since I hate multi-line prompts (no offense to those who like them of course).

    Reply
  • The UnDisbeliever says:
    September 13, 2009 at 10:07 am

    A lot of interesting ideas here, I’m gonna have to change my .bashrc in the immediate future.

    For the moment this is my bash prompt, after accidentally rebooting my laptop instead of my server for the eighth time in 12 hours, I decided to have separate command promts for a local login and a SSH login:

    if [ -z "$SSH_CLIENT" ]; then
    PS1=’\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$ \[\e[m\]\[\e[0;37m\]‘
    else
    PS1=’\[\e[0;32m\]\u\[\e[m\]\[\e[1;31m\]@\[\e[m\]\[\e[1;33m\]\h\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$ \[\e[m\]\[\e[0;37m\]‘
    fi

    As far as I know (I haven’t done any in depth searching), not many people have done separate prompts for different logins. Does anyone know of anyone else who does this?

    P.S. Sorry for the late comment, I always seam to arrive late to these blog posts. Why does nobody tell me anything until AFTER it happens?

    Reply
    • Joshua Price says:
      September 13, 2009 at 1:10 pm

      I haven’t seen anyone else change prompt based on SSH status, but many people have one prompt for root and another for users.

      Regarding the delay in finding/commenting, I’d recommend a feed reader to keep active on your favorite blogs. Nearly all blogs (including MTE) have RSS feeds you can send to something like Google Reader.

      Reply
  • rainer says:
    September 15, 2009 at 11:28 am

    can somebody help me to combine #8 and #2 ?
    i like the information provided by #8 but also the gimick turning red on a bad command of #2: so how would the code look like for a version of number 8 where all the green parts are turning red after a bad command? can t figure it out on my own.

    Reply
  • Amit Agarwal says:
    September 16, 2009 at 11:41 pm

    how about something like this

    if [[ \$? = "0" ]]; then color=”\\[\33[32m\\]“; else color=”\\[\33[31m\\]“; fi
    you can put this condition to get the color to set and use the variable color in #8 to set the color.

    Reply
  • Gavitron says:
    September 17, 2009 at 10:04 pm

    I use this on most of my accounts, the first line sets the terminal window to read “hostname:username – workingdir” an absolute must when you’ve got 20+ xterm/aterm/rxvt windows open to multiple machines, in one taskbar.

    PS1=”\[33]0;\h:\u – \w07\]\
    \[33[1;37m\][\
    \[33[1;35m\]\$(date +%H:%M) \
    \[33[1;36m\]\h\
    \[33[1;31m\]:\
    \[33[1;32m\]\w\
    \[33[1;37m\]]\
    \[33[0m\] “

    Reply
  • k00pa says:
    September 25, 2009 at 7:46 am

    Thanks! I love these! Now I am using number 2 :)

    It’s hard to decide what use now…

    Reply
  • Damian Montaldo says:
    December 1, 2009 at 9:32 am

    When I use the number 2 I can’t copy remote files using scp.
    I can do an ssh but I can’t copy files, why is that?

    Its very weird because I use that prompt for almost a week :)
    and I lost a two days looking for the error!

    I need some help, here is the scp debug:
    debug1: Next authentication method: password
    password:
    debug1: Authentication succeeded (password).
    debug1: channel 0: new [client-session]
    debug1: Entering interactive session.
    debug1: Sending environment.
    debug1: Sending env LANG = en_US.UTF-8
    debug1: Sending command: scp -v -t /tmp
    ……….
    I’m stuck here.

    Ps: Solved using the old PS1 bash prompt :)

    Reply
  • Carmen says:
    December 8, 2009 at 10:02 pm

    I love the happy face one!

    Reply
Cancel reply

Leave a Comment




Comment

Please Note: Comments maybe under moderation after you submit your comments so there is no need to resubmit your comment again

write for MTE

Latest Posts

  • OfficeMedium – A Social Collaboration Platform For The Small Business + Free Promotions
  • MakeTechEasier Is Now Hosted On KnownHost
  • KTorrent: KDE’s BitTorrent client
  • How to Create a Customized Toolbar for Your Browser
  • 13 Ways To Customize Ubuntu Netbook Remix For Better Usability

Our Writers

  • Damien Oh - Chief Editor
  • Sharninder - Geeky Ninja
  • Joshua Price
  • Tavis J. Hampton - Lantern Torch
  • Shevonne Polastre - FreeAgentWriter
  • Trevor Dobrygoski
  • Soumen Halder - Ampercent
  • Tanmay Ahmed - Tech-Tips-Geek
Make Tech Easier on Facebook
Jobs by SimplyHired
Job Widgets

Copyright

All the articles (including the text, images and tutorials) are properties of MakeTechEasier.

You cannot copy whole tutorials, either in English or translate to another language without our permission.

Write for us

Writing a tutorial or article for MakeTechEasier is a great way to get exposure and give back to the community.

Read More Details

Suggestions

We need your help to help us serve you better! This is YOUR site, so if you have suggestions/feedbacks on how we can improve it for you, please let us know! We do our best to make this place better!

Make a Suggestion

Navigation

  • Home
  • About Us
  • Advertise
  • Archives
  • Contact Us

Copyright © 2007-2010 Make Tech Easier | All Right Reserved.