Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-24-2011, 06:05 PM   #1
Registered: May 2010
Posts: 50

Rep: Reputation: 0
trailing slash / in path syntax

If you see this path by itself, no context or explanation:
/ab1/ab2/ab3 know that /ab1 is a directory off the root /, and that ab2 is a subdirectory; but ab3 could be either a subdirectory or a file, correct?

Contrast with:

...then the trailing slash means that ab3 must be a directory?

If my above understanding is correct: Is it considered good practice to avoid ambiguity and always add the trailing slash after the last directory in a path?
Old 03-24-2011, 06:17 PM   #2
LQ Guru
Registered: Apr 2005
Posts: 5,818

Rep: Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004
Yes. The trailing slash will designate a directory.
1 members found this post helpful.
Old 03-24-2011, 06:25 PM   #3
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 148Reputation: 148
@jim_d: You are correct on all points. I do agree that explicitly using the trailing slash eliminates ambiguity and should probably be considered good practice.


directory, path, slash

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add trailing slash adrianc.grigoras Linux - Software 1 05-13-2009 07:26 AM
Apache2 trailing slash issues! mephitic Linux - Software 2 02-04-2005 04:24 AM
Apache trailing slash boondock_saint Linux - General 9 07-07-2004 04:31 PM
Apache trailing slash puzzler tantric Linux - Software 4 04-11-2004 05:18 PM
Apache2 Trailing Slash Problem xwastedmindx Linux - Software 6 10-20-2003 09:59 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:53 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration