Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

when i open the terminal, it looks like this (without the *'s)

montenrgro@montenrgro-GE620-*******-*******-*****:~/Desktop$ 

the code thing and montenrgro@montenrgro takes up a lot of space, on my laptop. Any way I can decrease it to just: /home/Desktop. I'm sure there is some kinda of specialization to the terminal, but i can't find it. I've tried changing profile but that doesn't seems to work either

share|improve this question
up vote 4 down vote accepted

Don't forget to put the following line in your ~/.bashrc file, if you want the PS1 (stands for First Prompt String) to be permanent:

export PS1="\\w$ "

Similarly you can also change PS2 or PS3.

share|improve this answer

You can use the variable PS1. So you would do:

$ PS1=\\w$

to get what you want. You can read the manual page

$ man bash

and see under "PROMPTING" to read about the different options. Remember that you need to escape a backslash into a double backslash for the codes like \w.

share|improve this answer
    
when i write PS1 in the terminal, it gives me command not found – John Deer Aug 13 '12 at 11:22
    
The command is sensitive to spaces - PS1=\\w$ should work. (In the shell foo=bar sets variable foo to bar, foo = bar calls the program foo (if it exists) with arguments ` = bar`). – chronitis Aug 13 '12 at 11:46
    
edited the answer per chronitis' correction – John S Gruber Aug 13 '12 at 16:16

You should write:

export PS1=\\w$

in the end of the file ".bashrc" in your home directory.

Or use the command echo 'export PS1=\\w$' >> ~/.bashrc, that will do it without needing to open the file with a text editor.

share|improve this answer
    
It doesn't seem necessary to export this to the environment, just setting the PS1 variable seems to suffice. – John S Gruber Aug 13 '12 at 16:16

Using parse_git_branch, the following works as well.

if [ "$color_prompt" = yes ]; then
 PS1='NAME\w$(parse_git_branch)\[\033[00m\]\$ '
else
 PS1='NAME\w$(parse_git_branch)\$ '
fi

where you replace NAME with whatever you want displayed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.