LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Understanding directory structure (https://www.linuxquestions.org/questions/linux-general-1/understanding-directory-structure-946629/)

HalfMadDad 05-24-2012 08:33 AM

Understanding directory structure
 
So I am playing around with gcc's -v switch to see what it is doing behind the scenes. I don't understand the directory structure it is emitting.

So for instance during one phase it might list an object file to be linked in like this:

/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/lib/../lib/someObject.o

If I copy this line(minus the object file), cd to it and pwd, I get this:
/usr/arm-linux-gnueabi/lib

nice and clean and readable. I assume I end up in a totally differnt directory due to symbolic links but Why is gcc showing a directory structure with all the /../ pieces in it?

Thanks for reading-Patrick

pan64 05-24-2012 08:39 AM

this is how the path constructed. gcc will not take care about .. and other parts, will not simplify it, just prints it.

HalfMadDad 05-24-2012 08:47 AM

Hi pan64

Could you tell me what the /../ parts are for? I don't understand them.

Thanks for answering my post

pixellany 05-24-2012 09:07 AM

for reasons sometimes known only to the developers, path descriptions can be quite convoluted....

first ".." means move up one level in the directory tree.

Suppose you are in /home/username/files/xyz/

enter "cd .." and you will be in /home/username/files/

Now, suppose you are in /home/username/files/xyz/ and you want to display a file (fred) that is up one level under files:
more ../fred
OR
more /home/username/files/xyz/../fred
OR
more /home/username/files/fred

Play with a while and it will start to make sense.

HalfMadDad 05-24-2012 09:21 AM

hi pixellany


Thanks for you help. I knew about the cd .. but didn't know people used it in directories paths.

Have a great day :)


All times are GMT -5. The time now is 07:02 PM.