<s>
In	O
computing	O
,	O
cp	B-Application
is	O
a	O
command	B-Application
in	O
various	O
Unix	B-Application
and	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
for	O
copying	O
files	B-Operating_System
and	O
directories	B-Application
.	O
</s>
<s>
The	O
command	B-Application
has	O
three	O
principal	O
modes	O
of	O
operation	O
,	O
expressed	O
by	O
the	O
types	O
of	O
arguments	O
presented	O
to	O
the	O
program	O
for	O
copying	O
a	O
file	O
to	O
another	O
file	O
,	O
one	O
or	O
more	O
files	B-Operating_System
to	O
a	O
directory	B-Application
,	O
or	O
for	O
copying	O
entire	O
directories	B-Application
to	O
another	O
directory	B-Application
.	O
</s>
<s>
The	O
utility	O
further	O
accepts	O
various	O
command	B-Application
line	O
option	O
flags	O
to	O
detail	O
the	O
operations	O
performed	O
.	O
</s>
<s>
The	O
two	O
major	O
specifications	O
are	O
POSIX	O
cp	B-Application
and	O
GNU	B-Operating_System
cp	B-Application
.	O
</s>
<s>
GNU	B-Operating_System
cp	B-Application
has	O
many	O
additional	O
options	O
over	O
the	O
POSIX	O
version	O
.	O
</s>
<s>
The	O
command	B-Application
is	O
also	O
available	O
in	O
the	O
EFI	B-Architecture
shell	I-Architecture
.	O
</s>
<s>
cp	B-Application
was	O
part	O
of	O
Version	B-Operating_System
1	I-Operating_System
Unix	I-Operating_System
.	O
</s>
<s>
The	O
version	O
of	O
cp	B-Application
bundled	O
in	O
GNU	B-Application
coreutils	I-Application
was	O
written	O
by	O
Torbjorn	O
Granlund	O
,	O
David	O
MacKenzie	O
,	O
and	O
Jim	O
Meyering	O
.	O
</s>
<s>
cp	B-Application
has	O
three	O
principal	O
modes	O
of	O
operation	O
.	O
</s>
<s>
When	O
the	O
program	O
has	O
two	O
arguments	O
of	O
path	O
names	O
to	O
files	B-Operating_System
,	O
the	O
program	O
copies	O
the	O
contents	O
of	O
the	O
first	O
file	O
to	O
the	O
second	O
file	O
,	O
creating	O
the	O
second	O
file	O
if	O
necessary	O
.	O
</s>
<s>
When	O
the	O
program	O
has	O
one	O
or	O
more	O
arguments	O
of	O
path	O
names	O
of	O
files	B-Operating_System
and	O
following	O
those	O
an	O
argument	O
of	O
a	O
path	O
to	O
a	O
directory	B-Application
,	O
then	O
the	O
program	O
copies	O
each	O
source	O
file	O
to	O
the	O
destination	O
directory	B-Application
,	O
creating	O
any	O
files	B-Operating_System
not	O
already	O
existing	O
.	O
</s>
<s>
When	O
the	O
program	O
's	O
arguments	O
are	O
the	O
path	O
names	O
to	O
two	O
directories	B-Application
,	O
cp	B-Application
copies	O
all	O
files	B-Operating_System
in	O
the	O
source	O
directory	B-Application
to	O
the	O
destination	O
directory	B-Application
,	O
creating	O
any	O
files	B-Operating_System
or	O
directories	B-Application
needed	O
.	O
</s>
<s>
This	O
mode	O
of	O
operation	O
requires	O
an	O
additional	O
option	O
flag	O
,	O
typically	O
r	O
,	O
to	O
indicate	O
the	O
recursive	O
copying	O
of	O
directories	B-Application
.	O
</s>
<s>
If	O
the	O
destination	O
directory	B-Application
already	O
exists	O
,	O
the	O
source	O
is	O
copied	O
into	O
the	O
destination	O
,	O
while	O
a	O
new	O
directory	B-Application
is	O
created	O
if	O
the	O
destination	O
does	O
not	O
exist	O
.	O
</s>
<s>
The	O
removal	O
precedes	O
any	O
copying	O
performed	O
by	O
the	O
cp	B-Application
command	B-Application
.	O
</s>
<s>
-H	O
(	O
dereference	O
)	O
makes	O
the	O
cp	B-Application
command	B-Application
follow	O
symbolic	B-Application
links	I-Application
(	O
symlinks	B-Application
)	O
so	O
that	O
the	O
destination	O
has	O
the	O
target	O
file	O
rather	O
than	O
a	O
symlink	B-Application
to	O
the	O
target	O
.	O
</s>
<s>
If	O
one	O
enters	O
y	O
(	O
or	O
the	O
locale	O
's	O
equivalent	O
of	O
y	O
)	O
,	O
the	O
cp	B-Application
command	B-Application
continues	O
.	O
</s>
<s>
Any	O
other	O
answer	O
prevents	O
the	O
cp	B-Application
command	B-Application
from	O
overwriting	O
the	O
file	O
.	O
</s>
<s>
Creating	O
a	O
copy	O
of	O
a	O
file	O
in	O
the	O
current	O
directory	B-Application
:	O
</s>
<s>
This	O
copies	O
prog.c	O
to	O
prog.bak	O
.	O
</s>
<s>
If	O
the	O
prog.bak	O
file	O
does	O
not	O
already	O
exist	O
,	O
the	O
cp	B-Application
command	B-Application
creates	O
it	O
.	O
</s>
<s>
If	O
it	O
does	O
exist	O
,	O
the	O
cp	B-Application
command	B-Application
replaces	O
its	O
contents	O
with	O
the	O
contents	O
of	O
the	O
prog.c	O
file	O
.	O
</s>
<s>
Copy	O
two	O
files	B-Operating_System
in	O
the	O
current	O
directory	B-Application
into	O
another	O
directory	B-Application
:	O
</s>
<s>
This	O
copies	O
the	O
files	B-Operating_System
jones	O
to	O
/home/nick/clients/jones	O
and	O
smith	O
to	O
/home/nick/clients/smith	O
.	O
</s>
<s>
Copy	O
a	O
directory	B-Application
,	O
including	O
all	O
its	O
files	B-Operating_System
and	O
subdirectories	B-Application
,	O
to	O
another	O
directory	B-Application
:	O
</s>
<s>
This	O
copies	O
the	O
directory	B-Application
clients	O
,	O
including	O
all	O
its	O
files	B-Operating_System
,	O
subdirectories	B-Application
,	O
and	O
the	O
files	B-Operating_System
in	O
those	O
subdirectories	B-Application
,	O
to	O
the	O
directory	B-Application
customers/clients	O
.	O
</s>
<s>
Some	O
Unix	B-Application
systems	I-Application
behave	O
differently	O
in	O
this	O
mode	O
,	O
depending	O
on	O
the	O
termination	O
of	O
directory	B-Application
paths	O
.	O
</s>
<s>
Using	O
cp	B-Application
-R	O
/home/nick/clients/	O
/home/nick/customers	O
on	O
a	O
GNU	B-Operating_System
system	I-Operating_System
it	O
behaves	O
as	O
expected	O
;	O
however	O
,	O
on	O
a	O
BSD	O
system	O
,	O
it	O
copies	O
all	O
the	O
contents	O
of	O
the	O
"	O
clients	O
"	O
directory	B-Application
,	O
instead	O
of	O
the	O
directory	B-Application
clients''	O
itself	O
.	O
</s>
<s>
The	O
same	O
happens	O
in	O
both	O
GNU	B-Operating_System
and	O
BSD	O
systems	O
if	O
the	O
path	O
of	O
the	O
source	O
directory	B-Application
ends	O
in	O
.	O
</s>
<s>
or	O
..	B-Application
(	O
with	O
or	O
without	O
trailing	O
slash	O
)	O
.	O
</s>
<s>
The	O
copying	O
of	O
a	O
file	O
to	O
an	O
existing	O
file	O
is	O
performed	O
by	O
opening	O
the	O
existing	O
file	O
in	O
update	O
mode	O
,	O
thereby	O
preserving	O
the	O
files	B-Operating_System
inode	O
,	O
which	O
requires	O
write	O
access	O
and	O
results	O
in	O
the	O
target	O
file	O
retaining	O
the	O
permissions	O
it	O
had	O
originally	O
.	O
</s>
<s>
progress	O
,	O
Linux	O
tool	O
to	O
show	O
progress	O
for	O
cp	B-Application
,	O
mv	O
,	O
dd	O
.	O
</s>
