How to Show the Full Path in the OS X Terminal

Working and constantly switching between multiple projects in the OS X Terminal or iTerm (whatever you prefer) can be hassle since, by default, you cannot see the full path of the directory you're working in. Here's how to change that.

 

But first, in the spirit of full disclosure, I'd like to mention that I only found out how to display the full path after I accidentally destroyed the virtual machine of the wrong project and I had to install the whole damn thing all over again.

 

As you might have noticed, the Terminal only displays the current folder in which you're working so it can be pretty easy to make a mistake when your projects have a similar folder structure or are built with the same framework.

 

This first thing you need to do to address that is to fire up your Terminal and open your .bash_profile file:
[crayon-5ba21adff3caf007999449/]
Then head over to a new line and add:
[crayon-5ba21adff3cbc325218777/]
Save and close the file, then restart your Terminal. You should now notice that when you browse through your directories, the path should look something like this:
[crayon-5ba21adff3cc2712409292/]
The \w symbol you noticed stands for "Current working directory, full path (ie: /Users/Admin/Desktop)" while the $ mark followed by a space is simply a separator between the working path and the input area.

 

If you want to make the Terminal look even more awesome, here are some other options you can add to PS1:
[crayon-5ba21adff3cc8153928163/]
So for, example, using PS1="\u@\w$ " will output "Sebi@~/Development$ ".

I really hope this small tutorial helped. Have fun!