The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ksh: difference between $* and $@ JamesByars Shell Programming and Scripting 1 12-30-2007 10:08 AM
Difference between $* and $@ saneeshjose Shell Programming and Scripting 1 01-19-2006 08:03 AM
Difference between C and C++ hytechpro High Level Programming 2 11-29-2005 09:48 PM
difference rajashekaran UNIX for Advanced & Expert Users 1 04-23-2002 01:59 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-22-2007
deckard's Avatar
deckard deckard is offline
Registered User
  
 

Join Date: Jul 2002
Location: Ohio
Posts: 135
What's the Difference Between / and //?

Many times over the years, I've noticed that if I accidentally type 'cd //', my bash prompt will display that I am in // instead of /. If I do an ls command, it looks just like I'm in /. So this morning I decided to try and do 'cd ///' all the way up to a full 'cd //////'. None of those attempts did the same thing as //. Knowing that nearly everything in *nix seems to have a real purpose, I suspect // really means something slightly different from /. Are there any long time *nix users who might know the history? I've only been using *nix for ten years and haven't a clue.
  #2 (permalink)  
Old 05-22-2007
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
/ is a separator between components of a pathname. Consider /usr/bin/ksh. The leading slash tells you that this is a absolute pathname so you start at root and look for "usr". Then you look in "usr" for "bin". The path known as / is a little special. The leading slash says it's an absolute path so we start at root. And then we're done. With a path like /usr/bin//ksh you have superfluous separators. A path like that is not guaranteed to work so you shouldn't do it. But superfluous separators are easy to ignore and this is commonly done. The path // is a special case of a path with superfluous separators.


Code:
$ cd //
$ cd ///
$ cd //////
$ cd /////////
$ /usr/bin/pwd
/
$
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:55 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0