Solved

Linux path

Posted on 2011-03-15
4
469 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now