How do I change directories?

Below is additional information about how to change the directory or folder while working on a computer. Click on the below operating system you are looking for information on how to change directories or folders.

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

Microsoft Windows

To change directories (folders) while in Microsoft Windows, open either My Computer or Windows Explorer and double-click the folder you want to move into. For example, if we wanted to move into the "Boot" folder of the current "Windows" folder shown in the picture below we would double-click the "Boot" folder.

Windows File Explorer

Tip: Microsoft Windows users can also change directories at the Windows command line (MS-DOS) as explained below.

MS-DOS & Windows command line

To change directories while in MS-DOS or the Windows command line use the cd command. Below are some basic examples of how this command can be used to change directories.

Tree directory structureBefore changing directories, you need to know what directories are available in the current directory. To do this, use the dir command. For example, type the below command to only list directories in the current directory.

dir /ad

See the dir command page for further information and examples of this command. In the picture is an example of the tree command that list all directories and subdirectories from your current location.

Once you have a directory name, type a command similar to the command below, which is moving into the windows directory.

cd windows

If you need to move into multiple directories with one command, you can use a command similar to the example below. In this example, the command would move into the system directory, which is a subdirectory of the windows directory.

cd windows\system

Finally, if you need to move back a directory, you can use the below command.

cd..

If you were in the Windows directory when you typed this command, it would move you back to the C:\ directory.

  • See the MS-DOS and Windows command line cd command page for further information and examples of this command.

Linux and Unix

To change directories while in a *nix environment, use the cd command. Below are some basic examples of how this command can be used to change directories.

Before changing directories, you need to know what directories are available in the current directory. To do this, use the ls command. For example, type the below command to only list directories in the current directory.

ls -d */

See the ls command page for further information and examples of this command. Once you know the directory is available, type a command similar to the below command. The example below changes into the public_html directory.

cd public_html

If you need to move into multiple directories with one command, you can use a command similar to the example below. In the example below, the command would move into the cgi-bin directory, which is in the public_html directory.

cd public_html/cgi-bin

Finally, if you need to move back a directory, you can use the below command.

cd ..

If you were in the public_html directory when you typed this command, it would move you back into the home directory.

Note: There must be a space between cd and the two periods.

  • See the Linux and Unix cd command page for further information and examples of this command.

Additional information