Brian Ogden Brian Ogden - 4 months ago 12
Linux Question

Why is the following Linux directory valid

I am Linux novice, I am working with some C++ code that opens files in the following directory:

home/scs/SCS/


My home directory in Linux is set to "home/scs" when I run printenv HOME from terminal:
enter image description here

Now, with terminal opened and running from "home", if do
cd SCS
that works:

enter image description here

So, my terminal, in my screenshots, is it currently pointing at
home/scs/SCS
?
I don't think so.

What is confusing is that if we use the Ubuntu file explorer the home directory is just
/home
:

enter image description here

If navigate to the SCS directory it is just
/home/scs
:

So, in my C++ code, the value
/home/scs/SCS
is valid and is used throughout the code, it is "built" in C++ using the following code:

#define SCS_HOME "/home/scs/" // Target Machine.
#define PATH_TO_SCS QString(SCS_HOME) + "SCS/"


How can
/home/scs/SCS/
work? From my perspective the directory does not exist, but it is most certainly valid in the C++ code.

Answer

So, my terminal, in my screenshots, is it currently pointing at home/scs/SCS ? I don't think so.

Why not? The directory is clearly listed in the output of ls, and you even changed into it.

What is confusing is that if we use the Ubuntu file explorer the home directory is just /home

No, the dialog says that the location of your home directory (which is called /home/scs) is /home/. Your home directory is in /home/; that's its location. It is /home/scs.

If navigate to the SCS directory it is just /home/scs.

Yes, similarly, the SCS directory is found inside /home/scs/. That's its location.

Here's your directory structure:

/
+--- home
|      +--- scs
|      |     +--- SCS

What is confusing is that you created a user account named scs, with a home directory /home/scs, then put a directory named SCS inside it. Seems like a bad name for the directory.

Comments