Announcement

Collapse
No announcement yet.

Changing colour of prompt

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Changing colour of prompt

    I do most of my work in DOS where I have complete control over the colours using ANSI. I would like to use the same colours in Linux. If it means anything, here is the DOS prompt line which I normally use: PROMPT=$e[31;40;1m$p $$$e[32;40;1m

    Is there an equivelant in Linux? In the KDE konsole I use green text on black which suits me very well. The only problem is that the prompt is the same colour and I would like it to be red so that I can pick out all the prompt lines on a busy screen without so much difficulty. How can I change this? If that is difficult, then how about doing it in text mode - that would be OK too.

    #2
    Re: Changing colour of prompt

    If you use the default shell (bash), prompt is controlled by $PS1, $PS2, $PS3, $PS4 environment variables (where $PS1 is the "normal" prompt). If you want a permanent change, you should edit your ~/.bashrc file and change the PS1 variable to your liking.

    Extensive documentation:
    http://tldp.org/HOWTO/Bash-Prompt-HOWTO/
    (Chapter 6.1 is about Colouring)

    You can find a lot of howtos (often with examples) by googling, for example, "howto edit bash prompt"

    EDIT: most other shells have their ways to change the prompt, as well

    Comment


      #3
      Re: Changing colour of prompt

      Well then! That looks like exactly what I was looking for. Yes, chapter 6.1 on colouring looks like the familiar ANSI stuff. I never would have searched for "bash prompt", although it would seem obvious (duh) but for some reason nobody talks about it. Now I'm on my way. THANKS!

      Comment


        #4
        Re: Changing colour of prompt

        kubicle@

        Thanks for the link. I've bookmarked it. In fact, utilized it already to modify my prompt's color. Nice. 8)
        Using Kubuntu Linux since March 23, 2007
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment

        Working...
        X