Linux path

I am not sure my understanding for path correctly or not.
Suppose I am in the root "abc", I want to access the file "test.txt" in subfolder "xyz".
Then in the command or batch file, I used
xyz\test.txt

Open in new window

zhshqzycAsked:
Who is Participating?
 
point_pleasantConnect With a Mentor Commented:
you could use either

relative path of xyz/test.txt
absolute path /abc/xyz/test.txt

linux uses the forward slash "/" while dos uses the backslash "\"


0
 
farzanjCommented:
Linux uses forward slash NOT Windows back slash

Issue this
ls xyz/test.txt
0
 
upanwarCommented:
I will sugest you to access it with full path.

like:
/xyz/test.txt

0
 
woolmilkporcCommented:
Since you're under Linux you should use forward slashes (/) instead of backslashes (\).

And yes, xyz/test.txt is OK to access the file e.g. using an editor.

cat xyz/test.txt
vi xyz/test.txt

In order to execute it (if it's a script or a program) you should prepend "./" meaning the "current directory" because most often the current directory (".") is not in the search PATH for executables:

./xyz/test.txt


wmp

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.