Results 1 to 6 of 6

Thread: command prompt

  1. #1
    Join Date
    Jul 2008
    Location
    America
    Beans
    175
    Distro
    Ubuntu 10.04 Lucid Lynx

    command prompt

    How do i change the command prompt from
    ubuntu@ubuntu:~$

    to something cooler like

    coolbuntu@ubuntu:~$ .

  2. #2
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: command prompt

    You need to edit your ~/.bashrc file, see the following link for detailed instructions.

    http://tldp.org/HOWTO/Bash-Prompt-HOWTO/
    Cheesemill

  3. #3
    Join Date
    Apr 2008
    Beans
    451
    Distro
    Kubuntu 10.04 Lucid Lynx

    Re: command prompt

    please search this forums for customize BASH prompt - I remember a great tutorial about tweaking your bash prompt. Haven't bookmarked it though, there are several here in the forum archvie

  4. #4
    Join Date
    Oct 2007
    Location
    Chennai, India
    Beans
    3,803
    Distro
    Ubuntu Development Release

    Re: command prompt

    You can change your prompt by setting the environment variable PS1. For example
    Code:
    export PS1='coolbuntu@ubuntu \W:'
    will give you a prompt of
    Code:
    coolbuntu@ubuntu ~:
    . The "\W" is replaced with the current working directory.

    There are a number of settings you can use, including background/foreground colors, etc.
    For a further example, I use
    Code:
    ${debian_chroot:+($debian_chroot)}\[\033[0;32m\]\d \[\033[0;34m\]\t \[\033[0;0m\]\W:\$
    This gives me a prompt as
    Code:
    Tue Jul 14 21:32:28 ~:$
    The parts that follow a "\" are called escape sequences and are fully explained in the link given above in the post by Cheesemill.
    Last edited by prshah; July 14th, 2009 at 05:05 PM.
    Cheers,PRShah
    Make your own: Ubuntu, Kubuntu, Xubuntu, Mythbuntu All-in-One Live DVD
    "I never make mistakes; I thought I did, once.. but I was wrong."

  5. #5
    Join Date
    Jul 2008
    Location
    America
    Beans
    175
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: command prompt

    thanks, that helps

  6. #6
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    4,272
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: command prompt

    You can use '\e' instead of '\033'. So the previous example could read
    Code:
    ${debian_chroot:+($debian_chroot)}\[\e[0;32m\]\d \[\e[0;34m\]\t \[\e[0;0m\]\W:\$
    ('e' stands for 'escape', and 033 is the code that the computer receives -- or used to -- when you press the "Esc" button.)
    Full Circle Magazine :: Cheap Linux stickers :: Problems with WINE?
    In my day, we had outdoors in which to run, play, and socialise. Now we have computers to do those.

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
  •