geekvenue.net

Welcome to Chucktips Hardware HELP WITH DEAD OS Installing FreeBSD Miscellaneous
 faq
 search
 add article
 cool-stuff
 how-to
 main
 tips


HOWTO: Change your Shell Prompt
Documentation Posted by Understudy on Sunday December 15, @01:38PM
from the show us your prompts dept.
In my last article, I explanied how to change your shell. This article is on how to change your shell prompts. Please show us your prompt(s).
This article is very large almost 60k with no .jpegs. So I am hosting it on my site and backlinking to this one. This article will show you how to customize you prompts for the 6 most common shells. They are Bourne, Korn, BASH, Z, TC,and C. Here is the breakdown on the article.

The entire article from the top.

Just want to deal with a certain shells here ya go.

The Bourne Shell

The Korn Shell

BASH

The Z Shell

The TC Shell

The C Shell

The table for the shell prompt variables

That part covers just basic prompt changing. You can also add colors to your prompt. Provided your terminal supports them. Some of the color information.

The color prompts section

The ANSI color table

Text background colors

Attributes

How to color the different shells:

The Bourne Shell

The Korn Shell

BASH

The Z Shell

The TC Shell

The C Shell

And the lazy shell change:

The Interactive Non Login Shell

The Bourne Shell

The Korn Shell

BASH

The Z Shell

The TC Shell

The C Shell

Finally the lazy prompt change:

The Lazy Prompt Change

The Bourne Shell Lazy Prompt Change

The Korn Shell Lazy Prompt Change

The BASH Lazy Prompt Change

The Z Shell Lazy Prompt Change

The TC/C Lazy Prompt Change

That's it. Now show us your prompt. If you have cool website that would also be helpful please make a reply. Thanks.

<  |  >

 

Related Links
  • Articles on Documentation
  • Also by Understudy
  • Contact author

    Lilliput Mini USB Computer Monitor

    If you have ever wanted to learn about Cisco Routers, check out my new book "Cisco Routers for the Small Business" - it's Cisco CLI for the Regular Guy!

  • Sponsors

    The Fine Print: The following comments are owned by whoever posted them.
    ( Add a Reply )

    Re: HOWTO: Change your Shell Prompt
    by Jason on Friday December 27, @03:53PM
    This is a fantastic article and covers allot of information on many Unix shells. I know it took you a long time to research and write. I appreciate it very much!

    Thank you again and keep up the excellent work!


    Cheers,

    Jason

    [ Add a Reply to this ]
    • Re: HOWTO: Change your Shell Prompt
      by Joe Sanchez on Sunday August 03, @01:43PM
      Hi

      This is a great article and was of great assistance however, I would like to know how to change my cursor from a big flashing block to the small like as one has in the DOS environment.

      thanks
      joe
      [ Reply to this ]
    Re: HOWTO: Change your Shell Prompt
    by Matt on Tuesday August 23, @03:21PM
    Nice Article!
    [ Add a Reply to this ]
    Re: HOWTO: Change your Shell Prompt
    by Mat on Wednesday July 28, @09:56AM
    PS1="\[\033[7m\]\[\033[32m\]\d\[\033[30m\] \[\033[31m\]\u\[\033[30m\] \[\033[34m\]\[\033[1m\]\w\[\033[22m\]\[\033[30m\] $\[\033[27m\] "
    [ Add a Reply to this ]
    Re: HOWTO: Change your Shell Prompt
    by Mat on Wednesday July 28, @10:03AM
    Actually this is better: PS1="\[\033[7m\] \[\033[32m\] \d \t \[\033[30m\] \[\033[31m\] \u \[\033[30m\] \[\033[34m\]\[\033[1m\] \w \[\033[22m\]\[\033[30m\] $\[\033[27m\] " inverted green date time red user blue bold directory $ Thanks for the post.
    [ Add a Reply to this ]
    • Re: HOWTO: Change your Shell Prompt
      by Matthew Wilcoxson on Thursday July 29, @04:09AM
      This is my command line for bash:

      PS1="
      \[\033[42m\]\[\033[1;37m\]\[\033[1m\] \d \t \[\033[0m\] \[\033[41m\]\[\033[1;37m\]\[\033[1m\] \u \[\033[0m\]
      \[\033[44m\]\[\033[1;37m\]\[\033[1m\] \w \[\033[22m\]\[\033[0m\] $\[\033[0m\] "

      It goes across three lines, and works on dark or light backgrounds, and is designed to be clearly visible between normal text. It outputs a blank line, then shows the datetime (white on green) and user (white on red), then on the last line has the working directory (white on blue) and prompt (default colours).

      Tip: Always use "\[\033[0m\]" at the end so that it goes back to the current default so text colour never clashes with background.
      [ Reply to this ]

     
    The Fine Print: The following comments are owned by whoever posted them.
    ( Article Reply )

    "You never know how many friends you have until you own a Condo on the beach." -- Jason's Postulate

    Powered by Zope  Powered by Apache  Squishdot Powered
    All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest ©2001 Jason Neumann.
    [ main | post article | search ]