Solved

Linux path

Posted on 2011-03-15
4
476 Views
Last Modified: 2012-05-11
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

0
Comment
Question by:zhshqzyc
4 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 35137631
Linux uses forward slash NOT Windows back slash

Issue this
ls xyz/test.txt
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35137645
I will sugest you to access it with full path.

like:
/xyz/test.txt

0
 
LVL 8

Accepted Solution

by:
point_pleasant earned 50 total points
ID: 35137646
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
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 35137679
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

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Ubuntu Apache Webserver - File Permissions 5 58
winscp where are logs stored 3 51
linux - yum package installation issue 2 53
RHEL 6.7 Gnome Desktop on VMware 6 VM 9 63
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question