Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

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

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

    
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

3 Answers 3

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$'

or

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

if you like having a space between the $ and the command

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

source ~/.bash_profile
share|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
3  
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

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$ "
share|improve this answer
    
I like this one cause it puts it on it's own line. thanks for this! –  espradley Jun 12 at 14:37
    
very cool!!!!!! –  Nikos Oct 29 at 9:19

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

share|improve this answer

Your Answer

 
discard

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