LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   syntax (https://www.linuxquestions.org/questions/linux-newbie-8/syntax-4175648141/)

yangou 02-12-2019 09:46 AM

syntax
 
Hello

Can someone please tell me what ../../ mean below:

Code:

ln -s ../../images /tftpboot/proxy/bios/images
Many thanks

pan64 02-12-2019 10:07 AM

http://wiki.linuxquestions.org/wiki/Parent_directory
https://en.wikipedia.org/wiki/Path_(computing)

yangou 02-12-2019 10:11 AM

very informative

l0f4r0 02-12-2019 10:29 AM

Can you please mark your thread as [SOLVED] (see HOWTO in my sig) if you have no further question on this topic anymore?

yangou 02-12-2019 10:32 AM

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

hydrurga 02-12-2019 10:53 AM

Quote:

Originally Posted by yangou (Post 5961036)
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.

ehartman 02-12-2019 03:32 PM

Quote:

Originally Posted by hydrurga (Post 5961042)
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.

yangou 02-13-2019 03:44 AM

Quote:

Originally Posted by hydrurga (Post 5961042)
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.

Thank you hydrurga I got it now.

yangou 02-13-2019 03:44 AM

Quote:

Originally Posted by ehartman (Post 5961173)
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.

Thank you ehartman

l0f4r0 02-13-2019 04:27 AM

Quote:

Originally Posted by yangou (Post 5961036)
I was hoping someone could explain to me the ../../ bit

Oups...sorry, I thought you already had the material requested to answer your question.
I hope that matter is clearer for you now :)

rtmistler 02-13-2019 10:50 AM

Quote:

Originally Posted by yangou (Post 5961036)
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.


All times are GMT -5. The time now is 06:32 AM.