cd (command)

The command has been implemented in operating systems such as Unix, DOS, IBM OS/2,[1] MetaComCo TRIPOS,[2] AmigaOS[3] (where if a bare path is given, cd is implied), Microsoft Windows, ReactOS,[4] and Linux.

Consider the following subsection of a Unix filesystem, which shows a user's home directory (represented as ~) with a file, text.txt, and three subdirectories.

A similar session in DOS (though the concept of a "home directory" may not apply, depending on the specific version[vague]) would look like this: DOS maintains separate working directories for each lettered drive, and also has the concept of a current working drive.

[10] Note that executing cd from the command line with no arguments has different effects in different operating systems.

For example, if cd is executed without arguments in DOS, OS/2, or Windows, the current working directory is displayed (equivalent to Unix pwd).

Executing the cd command within a script or batch file also has different effects in different operating systems.

In DOS, the caller's current directory can be directly altered by the batch file's use of this command.

In the File Transfer Protocol, the respective command is spelled CWD in the control stream, but is available as cd in most client command-line programs.

A user's view of the file system in Unix-like systems begins with the home directory (often abbreviated to ~ ). From there, the tree can spread into more subdirectories and/or files.