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.
I was hoping someone could explain to me the ../../ bit
I understand that
/ is the root directory;
./ is the current directory;
../ is the parent of the current directory.
Does that mean ../../ is the same as /?
Thank you
It's the parent of the parent directory, so it's the grandparent directory of the current directory, i.e. 2 directories upwards towards the root.
Assuming of course that there *are* two directory levels in the structure above the current directory (../ when you are already at root leaves you still at root).
Edit: To answer your question, ../../ only works out to be the same as / if you start at root or a maximum of 2 directory levels beneath it.
It's the parent of the parent directory, so it's the grandparent directory of the current directory, i.e. 2 directories upwards towards the root.
In symbolical links I sometimes go upwards even more then 2 levels, so
../../../<some_path>
as to make that link relative to the directory it's IN instead of absolute (that is: starting with a /). This is to assure that the link still works, even when the whole tree is relocated (mv'd) to another place, which may be higher OR lower in the hierarchy.
It's the parent of the parent directory, so it's the grandparent directory of the current directory, i.e. 2 directories upwards towards the root.
Assuming of course that there *are* two directory levels in the structure above the current directory (../ when you are already at root leaves you still at root).
Edit: To answer your question, ../../ only works out to be the same as / if you start at root or a maximum of 2 directory levels beneath it.
In symbolical links I sometimes go upwards even more then 2 levels, so
../../../<some_path>
as to make that link relative to the directory it's IN instead of absolute (that is: starting with a /). This is to assure that the link still works, even when the whole tree is relocated (mv'd) to another place, which may be higher OR lower in the hierarchy.
I was hoping someone could explain to me the ../../ bit
Glad you feel you understand it. Just still wish to chime in.
To me it means "back two"
If you have ../../../ it means "back three"
Obviously starting with ../, that means "back one" and thus as you repeat, it just adds more to how far you are going back.
I would have to say that specifying a very long string like that becomes tedious and thus for command line, I'd make a decision to start back at some origin, like my home, or the root path, and then build up from there, also relying on tab completion of trings. In a script, I'd probably set a variable to define an origin directory. Like what is done in makefiles.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.