Thursday, April 7, 2022

[SOLVED] What is the difference between "/" and "//" directories in Linux?

Issue

I just discovered that I can access to admin directory through two path :

cd /
cd //

And in the second case (cd //), when I do pwd, output is : //
And the same when I'm going into /boot/ (pwd : //boot), /home/ (pwd : //home) and every other admin directory.

So what is the difference ? Is it just an alias, a bug or a specific feature ?


Solution

Use realpath to get the real path of your current directory. // is a symlink of / in some linux distributions and cd set pwd by what you've entered. It will be the same for all symlink directories you are in, if you get pwd after cd !



Answered By - Julie
Answer Checked By - Mary Flores (WPSolving Volunteer)