<s>
The	O
command	B-Application
,	O
also	O
known	O
as	O
(	O
change	B-Application
directory	I-Application
)	O
,	O
is	O
a	O
command-line	B-Application
shell	B-Operating_System
command	B-Application
used	O
to	O
change	O
the	O
current	B-Application
working	I-Application
directory	I-Application
in	O
various	O
operating	B-General_Concept
systems	I-General_Concept
.	O
</s>
<s>
It	O
can	O
be	O
used	O
in	O
shell	B-Language
scripts	I-Language
and	O
batch	O
files	O
.	O
</s>
<s>
The	O
command	B-Application
has	O
been	O
implemented	O
in	O
operating	B-General_Concept
systems	I-General_Concept
such	O
as	O
Unix	B-Application
,	O
DOS	B-Device
,	O
IBM	B-Application
OS/2	I-Application
,	O
MetaComCo	B-Device
TRIPOS	B-Operating_System
,	O
AmigaOS	B-Application
(	O
where	O
if	O
a	O
bare	O
path	B-Application
is	O
given	O
,	O
cd	B-Application
is	O
implied	O
)	O
,	O
Microsoft	B-Application
Windows	I-Application
,	O
ReactOS	B-Application
,	O
and	O
Linux	B-Application
.	O
</s>
<s>
On	O
MS-DOS	B-Application
,	O
it	O
is	O
available	O
in	O
versions	O
2	O
and	O
later	O
.	O
</s>
<s>
DR	O
DOS	B-Device
6.0	O
also	O
includes	O
an	O
implementation	O
of	O
the	O
and	O
commands	O
.	O
</s>
<s>
The	O
command	B-Application
is	O
also	O
available	O
in	O
the	O
open	B-Application
source	I-Application
MS-DOS	B-Application
emulator	B-Application
DOSBox	B-Application
and	O
in	O
the	O
EFI	B-Architecture
shell	I-Architecture
.	O
</s>
<s>
It	O
is	O
named	O
in	O
HP	B-Operating_System
MPE/iX	I-Operating_System
.	O
</s>
<s>
The	O
command	B-Application
is	O
analogous	O
to	O
the	O
Stratus	B-General_Concept
OpenVOS	I-General_Concept
command	B-Application
.	O
</s>
<s>
is	O
frequently	O
included	O
built	O
directly	O
into	O
a	O
command-line	B-Application
interpreter	O
.	O
</s>
<s>
This	O
is	O
the	O
case	O
in	O
most	O
of	O
the	O
Unix	B-Application
shells	I-Application
(	O
Bourne	B-Device
shell	I-Device
,	O
tcsh	B-Language
,	O
bash	B-Operating_System
,	O
etc	O
.	O
</s>
<s>
)	O
,	O
cmd.exe	B-Device
on	O
Microsoft	B-Application
Windows	I-Application
NT/2000	O
+	O
and	O
Windows	B-Application
PowerShell	I-Application
on	O
Windows	O
7+	O
and	O
COMMAND.COM	B-Operating_System
on	O
DOS/	O
Microsoft	B-Application
Windows	I-Application
3.x-9x/ME	O
.	O
</s>
<s>
The	O
system	B-Operating_System
call	I-Operating_System
that	O
effects	O
the	O
command	B-Application
in	O
most	O
operating	B-General_Concept
systems	I-General_Concept
is	O
that	O
is	O
defined	O
by	O
POSIX	O
.	O
</s>
<s>
Command	B-Application
line	I-Application
shells	O
on	O
Windows	B-Application
usually	O
use	O
the	O
Windows	B-Library
API	I-Library
to	O
change	O
the	O
current	B-Application
working	I-Application
directory	I-Application
,	O
whereas	O
on	O
Unix	B-Application
systems	I-Application
calls	O
the	O
POSIX	O
C	B-Language
function	O
.	O
</s>
<s>
This	O
means	O
that	O
when	O
the	O
command	B-Application
is	O
executed	O
,	O
no	O
new	O
process	B-Operating_System
is	O
created	O
to	O
migrate	O
to	O
the	O
other	O
directory	B-Application
as	O
is	O
the	O
case	O
with	O
other	O
commands	O
such	O
as	O
ls	B-Application
.	O
</s>
<s>
Instead	O
,	O
the	O
shell	B-Operating_System
itself	O
executes	O
this	O
command	B-Application
.	O
</s>
<s>
This	O
is	O
because	O
,	O
when	O
a	O
new	O
process	B-Operating_System
is	O
created	O
,	O
child	B-Operating_System
process	I-Operating_System
inherits	O
the	O
directory	B-Application
in	O
which	O
the	O
parent	B-Operating_System
process	I-Operating_System
was	O
created	O
.	O
</s>
<s>
If	O
the	O
command	B-Application
inherits	O
the	O
parent	B-Operating_System
process	I-Operating_System
 '	O
directory	B-Application
,	O
then	O
the	O
objective	O
of	O
the	O
command	B-Application
cd	B-Application
will	O
never	O
be	O
achieved	O
.	O
</s>
<s>
Windows	B-Application
PowerShell	I-Application
,	O
Microsoft	O
's	O
object-oriented	O
command	B-Application
line	I-Application
shell	B-Operating_System
and	O
scripting	B-Language
language	I-Language
,	O
executes	O
the	O
command	B-Application
(	O
cmdlet	O
)	O
within	O
the	O
shell	B-Operating_System
's	O
process	B-Operating_System
.	O
</s>
<s>
However	O
,	O
since	O
PowerShell	B-Application
is	O
based	O
on	O
the	O
.NET	B-Application
Framework	I-Application
and	O
has	O
a	O
different	O
architecture	O
than	O
previous	O
shells	O
,	O
all	O
of	O
PowerShell	B-Application
's	O
cmdlets	O
like	O
,	O
etc	O
.	O
</s>
<s>
run	O
in	O
the	O
shell	B-Operating_System
's	O
process	B-Operating_System
.	O
</s>
<s>
Of	O
course	O
,	O
this	O
is	O
not	O
true	O
for	O
legacy	O
commands	O
which	O
still	O
run	O
in	O
a	O
separate	O
process	B-Operating_System
.	O
</s>
<s>
A	O
directory	B-Application
is	O
a	O
logical	O
section	O
of	O
a	O
file	B-Application
system	I-Application
used	O
to	O
hold	O
files	O
.	O
</s>
<s>
Directories	B-Application
may	O
also	O
contain	O
other	O
directories	B-Application
.	O
</s>
<s>
The	O
command	B-Application
can	O
be	O
used	O
to	O
change	O
into	O
a	O
subdirectory	B-Application
,	O
move	O
back	O
into	O
the	O
parent	B-Application
directory	I-Application
,	O
move	O
all	O
the	O
way	O
back	O
to	O
the	O
root	B-Application
directory	I-Application
or	O
move	O
to	O
any	O
given	O
directory	B-Application
.	O
</s>
<s>
Consider	O
the	O
following	O
subsection	O
of	O
a	O
Unix	B-Application
filesystem	B-Application
,	O
which	O
shows	O
a	O
user	O
's	O
home	B-Application
directory	I-Application
(	O
represented	O
as	O
)	O
with	O
a	O
file	O
,	O
,	O
and	O
three	O
subdirectories	B-Application
.	O
</s>
<s>
If	O
the	O
user	O
's	O
current	B-Application
working	I-Application
directory	I-Application
is	O
the	O
home	B-Application
directory	I-Application
(	O
)	O
,	O
then	O
entering	O
the	O
command	B-Application
ls	B-Application
followed	O
by	O
might	O
produce	O
the	O
following	O
transcript	O
:	O
</s>
<s>
The	O
user	O
is	O
now	O
in	O
the	O
"	O
games	O
"	O
directory	B-Application
.	O
</s>
<s>
A	O
similar	O
session	O
in	O
DOS	B-Device
(	O
though	O
the	O
concept	O
of	O
a	O
"	O
home	B-Application
directory	I-Application
"	O
may	O
not	O
apply	O
,	O
depending	O
on	O
the	O
specific	O
version	O
)	O
would	O
look	O
like	O
this	O
:	O
</s>
<s>
DOS	B-Device
maintains	O
separate	O
working	B-Application
directories	I-Application
for	O
each	O
lettered	O
drive	O
,	O
and	O
also	O
has	O
the	O
concept	O
of	O
a	O
current	O
working	O
drive	O
.	O
</s>
<s>
The	O
command	B-Application
can	O
be	O
used	O
to	O
change	O
the	O
working	B-Application
directory	I-Application
of	O
the	O
working	O
drive	O
or	O
another	O
lettered	O
drive	O
.	O
</s>
<s>
Typing	O
the	O
drive	O
letter	O
as	O
a	O
command	B-Application
on	O
its	O
own	O
changes	O
the	O
working	O
drive	O
,	O
e.g.	O
</s>
<s>
;	O
alternatively	O
,	O
with	O
the	O
switch	O
may	O
be	O
used	O
to	O
change	O
the	O
working	O
drive	O
and	O
that	O
drive	O
's	O
working	B-Application
directory	I-Application
in	O
one	O
step	O
.	O
</s>
<s>
Modern	O
versions	O
of	O
Windows	B-Application
simulate	O
this	O
behaviour	O
for	O
backwards	O
compatibility	O
under	O
CMD.EXE	B-Device
.	O
</s>
<s>
Note	O
that	O
executing	O
from	O
the	O
command	B-Application
line	I-Application
with	O
no	O
arguments	O
has	O
different	O
effects	O
in	O
different	O
operating	B-General_Concept
systems	I-General_Concept
.	O
</s>
<s>
For	O
example	O
,	O
if	O
is	O
executed	O
without	O
arguments	O
in	O
DOS	B-Device
,	O
OS/2	B-Application
,	O
or	O
Windows	B-Application
,	O
the	O
current	B-Application
working	I-Application
directory	I-Application
is	O
displayed	O
(	O
equivalent	O
to	O
Unix	B-Application
pwd	B-Protocol
)	O
.	O
</s>
<s>
If	O
is	O
executed	O
without	O
arguments	O
in	O
Unix	B-Application
,	O
the	O
user	O
is	O
returned	O
to	O
the	O
home	B-Application
directory	I-Application
.	O
</s>
<s>
Executing	O
the	O
command	B-Application
within	O
a	O
script	O
or	O
batch	O
file	O
also	O
has	O
different	O
effects	O
in	O
different	O
operating	B-General_Concept
systems	I-General_Concept
.	O
</s>
<s>
In	O
DOS	B-Device
,	O
the	O
caller	O
's	O
current	B-Application
directory	I-Application
can	O
be	O
directly	O
altered	O
by	O
the	O
batch	O
file	O
's	O
use	O
of	O
this	O
command	B-Application
.	O
</s>
<s>
In	O
Unix	B-Application
,	O
the	O
caller	O
's	O
current	B-Application
directory	I-Application
is	O
not	O
altered	O
by	O
the	O
script	O
's	O
invocation	O
of	O
the	O
command	B-Application
.	O
</s>
<s>
This	O
is	O
because	O
in	O
Unix	B-Application
,	O
the	O
script	O
is	O
usually	O
executed	O
within	O
a	O
subshell	B-Operating_System
.	O
</s>
<s>
by	O
itself	O
or	O
will	O
always	O
put	O
the	O
user	O
in	O
their	O
home	B-Application
directory	I-Application
.	O
</s>
<s>
will	O
leave	O
the	O
user	O
in	O
the	O
same	O
directory	B-Application
they	O
are	O
currently	O
in	O
(	O
i.e.	O
</s>
<s>
the	O
current	B-Application
directory	I-Application
wo	O
n't	O
change	O
)	O
.	O
</s>
<s>
This	O
can	O
be	O
useful	O
if	O
the	O
user	O
's	O
shell	B-Operating_System
's	O
internal	O
code	O
ca	O
n't	O
deal	O
with	O
the	O
directory	B-Application
they	O
are	O
in	O
being	O
recreated	O
;	O
running	O
will	O
place	O
their	O
shell	B-Operating_System
in	O
the	O
recreated	O
directory	B-Application
.	O
</s>
<s>
cd	B-Application
~	O
username	O
will	O
put	O
the	O
user	O
in	O
the	O
username	O
's	O
home	B-Application
directory	I-Application
.	O
</s>
<s>
(	O
without	O
a	O
)	O
will	O
put	O
the	O
user	O
in	O
a	O
subdirectory	B-Application
;	O
for	O
example	O
,	O
if	O
they	O
are	O
in	O
,	O
typing	O
will	O
put	O
them	O
in	O
,	O
while	O
puts	O
them	O
in	O
.	O
</s>
<s>
will	O
move	O
the	O
user	O
up	O
one	O
directory	B-Application
.	O
</s>
<s>
The	O
user	O
can	O
use	O
this	O
indirection	O
to	O
access	O
subdirectories	B-Application
too	O
.	O
</s>
<s>
will	O
switch	O
the	O
user	O
to	O
the	O
previous	O
directory	B-Application
.	O
</s>
<s>
The	O
user	O
can	O
use	O
this	O
to	O
toggle	O
back	O
and	O
forth	O
between	O
two	O
directories	B-Application
without	O
pushd	B-Device
and	I-Device
popd	I-Device
.	O
</s>
<s>
no	O
attributes	O
print	O
the	O
full	B-Application
path	I-Application
of	O
the	O
current	B-Application
directory	I-Application
.	O
</s>
<s>
Print	O
the	O
final	O
directory	B-Device
stack	I-Device
,	O
just	O
like	O
dirs	B-Device
.	O
</s>
<s>
(	O
DOS	B-Device
and	O
Windows	B-Application
only	O
)	O
returns	O
to	O
the	O
root	O
dir	B-Device
.	O
</s>
<s>
Consequently	O
,	O
command	B-Application
always	O
takes	O
the	O
user	O
to	O
the	O
named	O
subdirectory	B-Application
on	O
the	O
root	B-Application
directory	I-Application
,	O
regardless	O
of	O
where	O
they	O
are	O
located	O
when	O
the	O
command	B-Application
is	O
issued	O
.	O
</s>
<s>
In	O
the	O
File	B-Protocol
Transfer	I-Protocol
Protocol	I-Protocol
,	O
the	O
respective	O
command	B-Application
is	O
spelled	O
in	O
the	O
control	O
stream	O
,	O
but	O
is	O
available	O
as	O
in	O
most	O
client	B-Protocol
command-line	B-Application
programs	I-Application
.	O
</s>
<s>
Some	O
clients	O
also	O
have	O
the	O
for	O
changing	O
the	O
working	B-Application
directory	I-Application
locally	O
.	O
</s>
<s>
The	O
command	B-Application
also	O
pertains	O
to	O
command-line	B-Application
interpreters	O
of	O
various	O
other	O
application	O
software	O
.	O
</s>
