LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 09-29-2004, 10:53 PM   #1
stardotstar
Member
 
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Rep: Reputation: 30
What is the diff between / and //


I am wondering what the difference between cd / and cd // is.

I am prompted to ask the question after encountering the following shell session:

Code:
[root@stardot forum]# cd //
[root@stardot //]# pwd
//
[root@stardot //]# ls
bin  boot  dev  etc  home  initrd  lib  lost+found  misc  mnt  opt  proc  root  sbin  selinux  sys  tmp  usr  var
[root@stardot //]# cd ////
[root@stardot /]# cd /
[root@stardot /]# ls
bin  boot  dev  etc  home  initrd  lib  lost+found  misc  mnt  opt  proc  root  sbin  selinux  sys  tmp  usr  var
[root@stardot /]# cd //
[root@stardot //]# ls
bin  boot  dev  etc  home  initrd  lib  lost+found  misc  mnt  opt  proc  root  sbin  selinux  sys  tmp  usr  var
[root@stardot //]# pwd
//
[root@stardot //]# cd ..
[root@stardot //]# pwd
//
[root@stardot //]# cd /./
[root@stardot /]# ls -lasd //
4 drwxr-xr-x  21 root root 4096 Sep 30 12:02 //
[root@stardot /]#
I think you will quickly see what I am getting at...

TIA

Will*
 
Old 09-30-2004, 01:02 AM   #2
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
There is no difference in those two cd commands, except that due to a small quirk in the shell, it prints the current path as // instead of /
Sometimes a script will end up with two /'s together in the middle of a path due to a / not being stripped off the end of a paramter - it makes no difference.
(example: ./configure --prefix=/usr/ might result in a path /usr//bin being used - this will just be /usr/bin)
 
  


Reply


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
diff in Java and C# and what are uses of both? servnov General 1 10-11-2004 09:23 PM
Dual Boot diff Hard Disk diff OS on Suse 9.1 wilhem Linux - Newbie 1 08-13-2004 06:06 PM
So, What's the diff.? The Manic Mouse Linux - Distributions 3 03-19-2004 07:38 AM
What a Diff! perry General 0 12-05-2003 07:10 PM
what is the diff safrout Linux From Scratch 2 05-27-2002 07:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:32 PM.

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