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


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.

| 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.

| 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.

| 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\]\$ '
 PS1='NAME\w$(parse_git_branch)\$ '

where you replace NAME with whatever you want displayed.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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