Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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


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

3 Answers 3

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 –  Montenegro Judas 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

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

Your Answer


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.