Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 30

Thread: HOWTO: Customize terminal header

  1. #11
    Join Date
    Aug 2007
    Location
    Torrington, Wyoming
    Beans
    372
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: HOWTO: Customize terminal header

    Actually the color was 1;36 the light cyan Sorry I was very misleading I didn't even make a reference to the color.
    すべてと、そして、すべてへのリナックスは自由を鳴らせました。
    Linux to all, and to all, let freedom ring.

  2. #12
    Join Date
    Dec 2007
    Location
    Columbia, South Carolina!
    Beans
    Hidden!
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: HOWTO: Customize terminal header

    Hey! I was just playing with this yesterday from the terminal. If you change the PS1 line from terminal directly, it will change, but it changes back when ya restart the terminal. I figured there would be a file in the back somewhere, and I noticed POR's sig, and rejoiced!

    Thanks, I like having the current time and date at the beginning. It makes things much more convenient.

    I'm using PS1='\T on \d - \u:\w\$' It shows the time in 12 hour with seconds, on the date - my user name:current dir$

    In the Terminal's edit, I changed the profile so it shows up 25% translucent, as well as displaying a better name for it that the PS1 line. In my case, 'Leo's Terminal'

    Leo S.
    The angels have the phone box!

  3. #13
    Join Date
    Feb 2008
    Beans
    15
    Distro
    Hardy Heron (Ubuntu Development)

    Re: HOWTO: Customize terminal header

    My PS1 lines are preceded by this:

    ${debian_chroot:+($debian_chroot)}
    So my line looks like:
    PS1='${debian_chroot:+($debian_chroot)}\[\e[0;31m\](\t)\[\e[m\]\[\e[0;32m\]\u\[\e[m\]@\[\e[0;34m\]\w\[\e[m\]\$ '

    What does this do, and is it required to run the terminal properly?

  4. #14
    Join Date
    May 2007
    Location
    Washington
    Beans
    909

    Re: HOWTO: Customize terminal header

    Quote Originally Posted by ChaoticVengeance View Post
    My PS1 lines are preceded by this:

    ${debian_chroot:+($debian_chroot)}
    So my line looks like:
    PS1='${debian_chroot:+($debian_chroot)}\[\e[0;31m\](\t)\[\e[m\]\[\e[0;32m\]\u\[\e[m\]@\[\e[0;34m\]\w\[\e[m\]\$ '

    What does this do, and is it required to run the terminal properly?
    Since I don't use a Debian based system, I don't know what it does but I do know you probably don't need it. However, if it's there it's probably doing something and it's not hurting anything, so don't touch it.

    You can just make a new PS1 line and put it at the end. The last PS1 line in the file is what is used.

  5. #15
    Join Date
    Jun 2007
    Location
    Sofia, Bulgaria
    Beans
    49
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Customize terminal header

    Thank you PurposeOfReason. Here is my terminal:


    Code:
    PS1='${debian_chroot:+($debian_chroot)}|\[\033[00;34m\]\u\[\033[00m\]\[^\]\[\033[00;34m\]\h\[\033[00m\]\[\033[00m\]:\[\033[00;33m\]\W\[\033[00m\]|\[\033[00;36m\]\$\[\033[00m\] '

  6. #16
    Join Date
    Oct 2006
    Beans
    Hidden!

    Re: HOWTO: Customize terminal header

    Here's another example of prompt customisation :
    Code:
    # Some colors
    #grey='\[\033[1;30m\]'
    #red='\[\033[0;31m\]'
    #green='\[\033[0;32m\]'
    GREEN='\[\033[1;32m\]'
    #blue='\[\033[0;34m\]'
    #BLUE='\[\033[1;34m\]'
    cyan='\[\033[0;36m\]'
    #CYAN='\[\033[1;36m\]'
    GREEN='\[\033[1;32m\]'
    #white='\[\033[1;37m\]'
    #yellow='\[\033[1;33m\]'
    RED='\[\033[1;31m\]'
    #violet='\[\033[1;35m\]'
    NC='\[\033[0;m\]'
    
    # if you are root (uid=0) brackets and @ in red, else in green for normal user
    if [ "`id -u`" -eq 0 ]; then
      b=$RED
      e="$NC# "
    else
      b=$GREEN
      e="$NC$ "
    fi
     PS1="${debian_chroot:+($debian_chroot)}$b[$NC\u$b@$NC\h:$cyan\w$b]$e"
    This could be either in $HOME/.bashrc for a single user, or in /etc/bash.bashrc for a system-wide setting


  7. #17
    Join Date
    Nov 2006
    Location
    There and back again
    Beans
    1,097

    Re: HOWTO: Customize terminal header

    Good howto. ASCII sequences can go beyond the predefined eight colors. The process isnt' all too difficult but I learned that Freexx has a converter that converts hexidecimal code to the corresponding bash ASCII sequence.

    http://frexx.de/xterm-256-notes/

    Install and:

    Code:
    echo d3d7cf | conv-rgb2xterm
    Alternatively instead of using ASCII, tput can be used:

    Code:
    export TXT_GR=$(tput setaf 2)
     export TXT_BL=$(tput setaf 4)
     export TXT_BLD=$(tput bold)
     export TXT_RESET=$(tput sgr0)
     export PS1='\[${TXT_GR}${TXT_BLD}\]@${TXT_BL} \w \$${TXT_RESET} '
    Just thought I'd throw that in.

    Last edited by Gen2ly; April 14th, 2008 at 01:15 AM.

  8. #18
    Join Date
    Mar 2007
    Location
    /US/EC/DC
    Beans
    Hidden!

    Re: HOWTO: Customize terminal header

    Is there any way to apply different PS1 lines to different terminal windows?

    I have a dark background, and want a light font color for my Devilspie induced Desktop Terminal. My regular terminal windows are the default Ubuntu Human theme, so a light font is difficult to read.

    Can I do this, or do I have to find a happy medium?

  9. #19
    Join Date
    Mar 2008
    Location
    Earth
    Beans
    189

    Re: HOWTO: Customize terminal header


    PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]'

    The user@host part is a different color for each of the servers so I can quickly differentiate which machine I'm connected to. Green is my laptop.

    @Skones: If your desktop terminal is run from a different program you can put an export PS1 in the launcher. You can set a PS1 in bashrc which will persist across terminals, put an export line in gnome-terminal's launcher, and another in whichever program you use for the desktop terminal.
    Last edited by conundrumx; June 26th, 2008 at 05:03 PM.

  10. #20
    Join Date
    May 2008
    Beans
    Hidden!

    Re: HOWTO: Customize terminal header

    Thanks for the tip, works like a charm. Here's mine;

    Last edited by trappy; July 2nd, 2008 at 03:36 AM.

Page 2 of 3 FirstFirst 123 LastLast

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
  •