[SOLVED] confused about when to use cd ~/whatever or cd /whatever
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.
for example, cd /boot or cd /bin works, but cd ~/bin or cd ~/boot does not
That's because there is no bin or boot directory in your /home/user directory.
Quote:
cd /Dropbox or cd /Documents doesn't.
If you are in your /home/user directory then using cd Documents will work. If you want to change to a directory which is in the directory you are using, for example /home/user which has a Documents directory, don't use the forward slash /.
It depends also on where you are starting from. If you have a directory named junk in your /home/user/Documents directory you can get to it by simply typing: cd junk IF you are in the /home/user/Documents directory. You can access anything by using the full path from anywhere in the system.
It is quite revealing when the curtain is pulled back just a bit, and I realize how much I don't know. I didn't realize that in my original post, when the cd paths I used worked, it was because i was typing in the exact correct path. See, what I thought was happening was something magical. like by typing cd /loren for example, that i would be magically transported there, regardless of my starting point. It would be nice, but what if there where two "loren" directories, in different places, right? how would that work? luck of the draw?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.