How do I change directories?

Below is additional information about how to change a directory or folder while working on a computer. Click on the below operating system you're 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 folders while in Microsoft Windows, open either My Computer or Windows Explorer and double-click the folder you want to move into.

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

MS-DOS and Windows command line

To change directories while in MS-DOS, 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 MS-DOS dir command. For example, type the below command to only list directories in the current directory.

dir /ad

  • See the dir command page for additional 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 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 the example below, the command would move into the system directory, which is in 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 cd command page for additional 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 additional 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.

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

Additional information

  • See the directory and folder definition for further information and related links.