Results 1 to 2 of 2

Thread: changing command prompt...?

  1. #1
    Join Date
    Jul 2008
    Location
    Aryadesa
    Beans
    183
    Distro
    Ubuntu 12.04 Precise Pangolin

    changing command prompt...?

    How can i change command prompt? I know it can be done by tweaking .bashrc
    (im using bash shell), specifically by changing PS1.But im unable to decode the code.

    thanks
    Quantum computers are not known to be able to solve NP-complete problems in polynomial time.
    Scott Aaronson's blog

  2. #2
    Join Date
    May 2007
    Location
    albuquerque
    Beans
    581
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: changing command prompt...?

    I don't know how others have done it. In Hardy the bashrc stuff looks more complicated than in some other distros.



    In Hardy, I changed the user prompt to green by editing the 2nd PS1 line in this section of ~/.bashrc:

    if [ "$color_prompt" = yes ]; then
    PS1="${debian_chroot:+($debian_chroot)}\e[1;31m\u[\w]\\$ \e[m "
    else
    #changed the PS1 below on 6/14/08 for a color prompt
    PS1='${debian_chroot:+($debian_chroot)}\[\e[1;32m\]\u[\w]\\$ \[\e[m\] '

    fi



    Also in Hardy, I changed changed the root prompt to red by editing the 2nd PS1 line in this section of /root/.bashrc:

    # set a fancy prompt (non-color, unless we know we "want" color)
    case "$TERM" in
    xterm-color)
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    ;;
    *)
    # changed 6/14/08 for a red root prompt
    PS1='${debian_chroot:+($debian_chroot)}\e[1;31m\u[\w]\\$ \e[m '

    ;;
    esac


    Good luck. Here's the Bash Prompt HOWTO, if that helps: http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/index.html

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •