Results 1 to 4 of 4

Thread: customize terminal prompt

  1. #1
    Join Date
    Oct 2007
    Beans
    18

    customize terminal prompt

    Hi All,

    I am interested to find out if I can customize the prompt in my terminal.
    Specifically I would like it NOT to display the complete path to the working directory as this is often quite long and I really don't like it when my commands wrap around, but I do want to still see the complete path in the title,

    any help is greatly appreciated.

  2. #2
    Join Date
    Nov 2008
    Beans
    482

    Re: customize terminal prompt

    Some very "old style" prompt
    Code:
    export PS1="> "
    Current path is still viewed in window title.

  3. #3
    Join Date
    Oct 2007
    Beans
    18

    Re: customize terminal prompt

    Oh my that was easy!

    Thank you, I sure wish I did not have to ask these easy questions...

  4. #4
    Join Date
    Apr 2006
    Location
    Atlanta, USA
    Beans
    427

    Re: customize terminal prompt

    If you want to display specific information in the prompt you can use the following escape sequences:
    (more at this link)
    \u -- user
    \h -- hostname
    \d -- date
    \t -- time
    \w -- current working directory
    \W -- abbreviated working directory (just the current directory)

    Right now your prompt is probably set to something like:
    "\u@\h:\w$ " changing it to "\u@\h:\W$ " will save you some space and still display the current directory.
    (eg, "user@host:/usr/share/doc/foo-bar$" would become "user@host:foo-bar$")
    Here we are, trapped in the amber of the moment. There is no why.

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
  •