What is the difference between cd .. and cd\ or cd / commands?

Updated: 03/06/2020 by Computer Hope

MS-DOS and Windows command line users

Windows DOS command prompt window

When typing the cd.. or cd .. (with a space) command, this moves the directory back one directory, also known as the parent directory. As shown 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, typing cd... moves back two directories.

The cd\ command takes you back to the root directory of the current drive. As shown below, if you 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, to get to the C:\Windows\Temp directory 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 shown 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 shown 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. To get to the root home directory (~) type: cd ~ (tilde) at the prompt.