In my ubuntu terminal I have always current directory shown completely. Just like this:

blabla@blublu:~/music/my_album/classical/beethoven$

But in my Mac (Mac OS X 10.6.5) terminal does not show the full path and it is like this:

blabas-MacBook-Pro:classical beethoven$

Is there anyway that I change mac terminal behavior to act like linux terminal?

link|improve this question
there must be a screen in preferences of Terminal App. which you can change behaviors. – fsonmezay Jan 31 '11 at 16:00
Linux terminals don't magically show the full path; it depends on your settings. Some linux distros configure things to show the full path by default, some don't. It all depends on the $PS1 variable. (See Asmus's answer.) – frabjous Jan 31 '11 at 18:37
feedback

migrated from stackoverflow.com Jan 31 '11 at 16:17

This question came from our site for professional and enthusiast programmers.

3 Answers

To let bash return "user@hostname:path/to/directory$" as your prompt, add the following line to your ~/.bash_profile:

export PS1='\u@\H:\w$'

to make the changes take effect immediately, run the following command in every open window (or restart Terminal):

source ~/.bash_profile
link|improve this answer
Or just enter that PS1 assignment in every open window. By the way, the export is unnecessary. – Dennis Williamson Jan 31 '11 at 16:37
2  
Actually, if you don´t use export, your would be defining a shell variable, not an environment variable, so PS1 would not be passed globally to all processes. – Asmus Jan 31 '11 at 16:49
feedback

I am not sure about Mac, but in Ubuntu I've changed the Gnome Terminal prompt with

PS1="\a\n\n\e[31;1m\u@\h on \d at \@\n\e[33;1m\w\e[0m\n$ "
link|improve this answer
feedback

Inside PS1 value, "\w" represents the full path, where "\W" represents the current directory name only.

http://tldp.org/HOWTO/Bash-Prompt-HOWTO/bash-prompt-escape-sequences.html

link|improve this answer
feedback

Your Answer

 
or
required, but never shown