At first, this didn't bug me to much, however it gets really annoying typing in
pwdevery-other time just to make sure you are in the right directory
"...am I in
/usr/bin/or am I in
/usr/local/bin/... am I in
/System/Library/, or am I in
This got old quickly so I decided to ask my Linux mentor, who also happens to be my boss, if he had a solution. He did a little research, we found a solution, and I was so happy to have figured this out I thought I'd post a blog in hopes that I can help other people out who are also bothered by this.
First things first: You'll need to know what "
~refers to your "Home" folder. You're Home folder is located in the
/Users/folder in Leopard. A lot of times this is your full name. In my case, my Home Directory is
jonathansmith68. The tilde comes handy when you want to
cdto your Home Directory quickly.
-Simply enter the following command into Terminal at any time in order to
cd(or changedirectory) into your Home Folder.
Also note that anytime you open Terminal, by default, it places you in your Home Directory.
Now that we've discussed what the Home Directory is, explaining how to add this functionality will be much easier.
First you'll have to create a file named "
.bash_profile" inside your Home Directory. It is under my impression that most, if not all Linux distros already have this file, but it appears that Leopard does not, so you'll have to make it yourself.
Note: Files and Folders that begin with "." are hidden in Leopard. In terminal in order to see these hidden files and folders you must enter the "
ls" (list) command along with the "
-a" (all) option. This will show all the files and folders located in your current directory.
You can create the "
.bash_profile" file in any kind of text editor, whether it be Vi Editor, TextEdit, or TextMate. I'm lazy and didn't want to learn Vi so I decided to just create the file in TextEdit.
1.) Open TextEdit and Enter the following String of text:
export PS1="[\u@\h \w]\\$
2.) Go to File --> Save As...
3.) Uncheck the Box that says "If no extension is provided, use ".txt"."
4.) Name the file "
5.) Make sure to save this to your Home Directory, this can be found in the sidebar and/or the drop down box and is represented by a small Home Icon.
6.) A Dialog box will pop up telling you that filenames that being with a "." are reserved for the system (hidden files) and asks if you are sure that you want to use the "." in the beginning. Simply click "Use ".""
Once the file has been saved into your Home Directory, all you need to do is quit out of Terminal, and reopen it.
You should now be able to see the full Directory Path at all times!
I'd like to give credit to this website for most of the information. Thanks to Mac OS X's Unix roots, it was possible to adapt this to Leopard.