If you don't know where you are, you can always type, "pwd" to see the "Current Working Directory"--where you are right now.
Depending on how your computer is set up, you can have it so that your command prompt always tells you where you are. I find this useful, especially coming from a DOS or Windows command-line background.
If your prompt isn't showing you this, or if it's just telling you the last part of your directory tree, you can change it, as follows.
First, find out what your command prompt variable, PS1 is right now:
Remember that all command text is case-sensitive.
First, look for "\w" or "\W" in what that command gives you. If you see "\W" (capital W), it's only showing you the last part of your directory tree. If you see "\w" (lowercase w), it's showing you the whole thing, and you don't need to change it. (If your prompt ever says you're in "~", that means you're in your home directory: "/home/yourusername".)
Now, backup your bash configuration file, /home/yourusername/.bashrc:
Code:
cp -vf /home/yourusername/.bashrc /home/yourusername/.bashrc.backup
OR
cp -vf ~/.bashrc ~/.bashrc.backup
(These commands do the same thing.)
Now, if you need to make a change, highlight and copy the output of your "echo $PS1" command. Then, use a text editor--probably gedit or kedit--to edit the file, /home/yourusername/.bashrc--like this:
Code:
gedit /home/yourusername/.bashrc
OR
kedit /home/yourusername/.bashrc
In that file, look for any line that says, "PS1='blahblahblah'". If that line exists, change the capital W to a lowercase one, save and exit. If there is no '\W'--capital or lowercase (which is rare on Linux distributions), then you can add it somewhere before "\$". If you put it in the wrong place, you can always edit the file and try again. If you ever really screw it up, you can do this to restore the backup file:
Code:
cp -vf ~/.bashrc.backup ~/.bashrc
Finally, to make your changes take effect, do this:
Code:
source ~/.bashrc
OR
. ~/.bashrc
("." is a shortcut for the "source" command.)
You should now have a command prompt that always tells you where you are! If, by some chance, when you reboot or log out/in, your command prompt doesn't stay this way, it's because your version of Linux doesn't automatically read ~/.bashrc like it should. Let me know if this is the case, and I'll tell you how to fix it.
Cheers!
--Dane