Difference between cd .. and cd\ or cd / commands

MS-DOS and Windows command line users
Linux and Unix users

Windows DOS command prompt windowMS-DOS and Windows command line users

When typing the cd.. or cd .. (with a space) command this moves the directory back one directory also known as the parent directory. As seen in the example below, if you're in the \Windows\System32 directory using the cd.. command takes you back to the Windows directory.

C:\Windows\System32>cd..

C:\Windows>

Tip: You can also type three or more periods in a row to move back multiple directories. For example, type: cd... will move back two directories.

The cd\ command takes you back to the root directory of the current drive. As can be seen in the example below, if we were in the same \Windows\System32 directory and typed the cd\ command it would take you to the C:\ directory.

C:\Windows\System32>cd\

C:\>

Tip: You can also type the path after the cd\. For example, if you wanted to get to the C:\Windows\Temp directory you could type: cd\windows\temp to get into that directory regardless of where you are on the C: drive.

Linux and Unix users

When typing the cd .. command (need to have a space between cd and ..) this moves the directory back one directory also known as the parent directory. As seen in the example below, if you're in the /public_html/cgi-bin directory using the cd.. command takes you back to the public_html directory.

 [~/public_html/cgi-bin]# cd ..

 [~/public_html]#

The cd / command takes you back to the root directory of the current drive. As can be seen in the example below, if we were in the same /public_html/cgi-bin directory and typed the cd / command it would take you to the / directory.

[~/public_html/cgi-bin]# cd /

[/]#

Tip: Unless you have root rights or proper permissions you cannot list the files in this directory. If you want to get to the root home directory (~) Type: cd ~ at the prompt.

Additional information