Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
In all cases, the directory you are actually in is "/". See the output from "/bin/pwd".
Your shell keeps track internally of the path to your CWD, and "//" is mostly equivalent to "/". This internal path can be significant when symbolic links are involved. Try running the following 4 commands:
Code:
ln -s /etc /tmp/myetc
cd /tmp/myetc
pwd
/bin/pwd
Now try "cd ..". Your shell will move up on its internal path and put you in "/tmp", while the actual parent of "/etc" is "/".
Contrast this with:
Code:
cd /tmp/myetc
cd -P ..
The "-P" tells cd to follow the physical path, and it will put you in "/".
Last edited by rknichols; 12-27-2016 at 12:43 PM.
Reason: Clarify that the first set is 4 commands, not 3 commands and a response.
(BTW, if I'm following things right, shouldn't the fourth line in your first code example should be '/tmp/myetc'?)
No, "/bin/pwd" is a system command that will show your current working directory independent of what your shell has stored. That's in contrast with just "pwd", which is a shell built-in.
Bash maintains the double forward slashes in case the particular implementation using Bash actually treats these as different from a single forward slash.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.