Page 3 of 3 FirstFirst 123
Results 21 to 30 of 30

Thread: HOWTO: Customize terminal header

  1. #21
    Join Date
    May 2006
    Location
    Toronto, Ontario
    Beans
    30
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: HOWTO: Customize terminal header

    Here is mine (Kind of long):
    \[\e]0;\u@\h: \w\a\]\[\e[33;1m\]\u\[\e[37;1m\]@\[\e[32;1m\]\h\[\e[20;1m\]\[\e[34;1m\](\[\e[31;1m\]\w\[\e[34;1m\])\[\e[0m\]$\[\e[0m\]
    Nick Presta

  2. #22
    Join Date
    May 2006
    Location
    Saskatoon, SK, Canada
    Beans
    178
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Customize terminal header

    If I use the default then anything I type wraps to the next line when it reaches the end of the Terminal window. If I alter it then it simply wraps o the beginning of the same line I started typing on.

    Default:
    Code:
    ${debian_chroot:+($debian_chroot)}\u@\h:\w\$
    Mine:
    Code:
    \[\e[0;33m\] [\W] \$\e[m\]
    And when in my home folder that gives me the nice simple prompt of
    Code:
    [~]
    Sample of problem:
    Code:
    geoff@Podfather:~$ sample text sample text sample text sample text sample text sample text
    bash: sample: command not found
    geoff@Podfather:~$ export PS1='\[\e[0;33m\] [\W] \$\e[m\]'
    t[~] $ sample text sample text sample text sample text sample text sample tex
    Note in the bold line how the last 't' in the final 'text' wraps to the beginning of the line I am typing on instead of wrapping to the next line? If I were to continue typing it would overwrite the rest of the line I started on.

    It also messes with using the up and down arrow keys to scroll through the command history, but that's much harder to describe.

    How do I fix this?

  3. #23
    Join Date
    Aug 2007
    Location
    Cluj/Kolozsvár, Romania
    Beans
    189

    Re: HOWTO: Customize terminal header

    Quote Originally Posted by SentientFluid View Post
    If I use the default then anything I type wraps to the next line when it reaches the end of the Terminal window. If I alter it then it simply wraps o the beginning of the same line I started typing on.
    Whatever makes the same line being used over again, it has to do with the strange escape sequences you are using.
    From what you posted, the basic pattern you want for your prompt is '[\W] \$ '. The rest is coloring it by adding escape sequences, e.g. '\[\e[0;33m\]'. The M;3N (0;33 in my example) is the part where you specify the color - N is a number between 0 (black) and 7 (white), and M is either 0 (dark) or 1 (bright).
    The escape sequence is '\[\e[0m\]' - you need to use this after the parts you intend to color, so that the following text will have the default color.
    As an example, try this:
    Code:
    PS1='\[\e[0;33m\][\W] \[\e[0m\]\$ '

  4. #24
    Join Date
    May 2006
    Location
    Saskatoon, SK, Canada
    Beans
    178
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Customize terminal header

    Quote Originally Posted by kaiju View Post
    Whatever makes the same line being used over again, it has to do with the strange escape sequences you are using.
    From what you posted, the basic pattern you want for your prompt is '[\W] \$ '. The rest is coloring it by adding escape sequences, e.g. '\[\e[0;33m\]'. The M;3N (0;33 in my example) is the part where you specify the color - N is a number between 0 (black) and 7 (white), and M is either 0 (dark) or 1 (bright).
    The escape sequence is '\[\e[0m\]' - you need to use this after the parts you intend to color, so that the following text will have the default color.
    As an example, try this:
    Code:
    PS1='\[\e[0;33m\][\W] \[\e[0m\]\$ '
    That helped, thanks! I wasn't escaping the closing sequence correctly. This is working fine now:

    Code:
    export PS1='\[\e[0;33m\][\W]\$\[\e[0m\] '
    Teach me to try and do this when I'm tired.

  5. #25
    Join Date
    Mar 2009
    Location
    YS
    Beans
    57
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Customize terminal header

    i don't even know how to find or access a ~/.bashrc file. do i get to it from the terminal? how do i edit it? the tutorial isn't in depth enough, at least, not for me.
    Nothing real can be threatened.
    Nothing unreal exists.

  6. #26
    Join Date
    Jan 2008
    Location
    USA
    Beans
    21
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: HOWTO: Customize terminal header

    Quote Originally Posted by D1ZZ4ZZT3R View Post
    i don't even know how to find or access a ~/.bashrc file. do i get to it from the terminal? how do i edit it? the tutorial isn't in depth enough, at least, not for me.
    To access your ~/.bashrc file type into the terminal:

    sudo gedit ~/.bashrc

    to add and save changes to your ~/.bashrc file via the gedit text editor.

  7. #27

    Re: HOWTO: Customize terminal header

    This is one of the nice how-to

  8. #28
    Join Date
    Apr 2007
    Location
    Belgium
    Beans
    1,528

    Re: HOWTO: Customize terminal header

    Quote Originally Posted by Jpardue View Post
    To access your ~/.bashrc file type into the terminal:

    sudo gedit ~/.bashrc

    to add and save changes to your ~/.bashrc file via the gedit text editor.
    There's no need in opening the user owned .bashrc as root. Besides, if you want to open a file as root in a graphical program, one should use gksudo.
    Disclaimer: I am currently suffering from severe CSD (Compulsive Sarcasm Disorder).
    My Site | Linux User #452328 | Running Arch Linux on Sony Vaio VGN-SZ61XN/C since October 2008

  9. #29
    Join Date
    Apr 2009
    Location
    Texas
    Beans
    64
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: HOWTO: Customize terminal header

    Hi, I have mine set up with the colors I want and it looks like [jake-ubuntu|05:47 PM|jake] ~ $
    (but has colors)

    I want to know if I make the | signs green, and keep everything else there same colors.

    Is this possible?

    If it is can you show me the code and where to put it in the ps1 line?

    Thanks!

    Edit : Never mind, I figured it out . I just had to add a "\" after "|"
    Last edited by Evilhugbear; February 21st, 2010 at 03:57 AM. Reason: Figured it out

  10. #30
    Join Date
    Jun 2005
    Location
    South Dakota, US
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: HOWTO: Customize terminal header

    Quote Originally Posted by NickPresta View Post
    Here is mine (Kind of long):
    \[\e]0;\u@\h: \w\a\]\[\e[33;1m\]\u\[\e[37;1m\]@\[\e[32;1m\]\h\[\e[20;1m\]\[\e[34;1m\](\[\e[31;1m\]\w\[\e[34;1m\])\[\e[0m\]$\[\e[0m\]
    Ya.... that's impressive. A lot of colors.
    I go for this one:
    export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

Page 3 of 3 FirstFirst 123

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
  •