source: trunk/minix/man/man1/cp.1@ 20

Last change on this file since 20 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 5.5 KB
RevLine 
[9]1.TH CP 1
2.SH NAME
3cp, mv, rm, ln, cpdir, clone \- copy, move, remove, link
4.SH SYNOPSIS
5.B cp
6.RB [ \-pifsmrRvx ]
7.I file1 file2
8.br
9.B cp
10.RB [ \-pifsrRvx ]
11.IR file " ... " dir
12.PP
13.B mv
14.RB [ \-ifsmvx ]
15.I file1 file2
16.br
17.B mv
18.RB [ \-ifsvx ]
19.IR file " ... " dir
20.PP
21.B rm
22.RB [ \-ifrRvx ]
23.IR file " ..."
24.PP
25.B ln
26.RB [ \-ifsSmrRvx ]
27.I file1 file2
28.br
29.B ln
30.RB [ \-ifsSrRvx ]
31.IR file " ... " dir
32.PP
33.B cpdir
34.RB [ \-ifvx ]
35.I file1 file2
36.PP
37.B clone
38.RB [ \-ifsSvx ]
39.I file1 file2
40.SH DESCRIPTION
41.de SP
42.if t .sp 0.4
43.if n .sp
44..
45The utilities
46.BR cp ,
47.BR mv ,
48.BR rm ,
49and
50.B ln
51do basic file management: copying, renaming or moving, deletion, and
52creating links. (The
53.B cpdir
54and
55.B clone
56utilities are easy to use aliases for copying or linking whole trees.
57They are the same as
58.B cp \-psmr
59and
60.BR "ln \-fmr" )
61.PP
62The first synopsis form of the utilities
63.BR cp ,
64.BR mv ,
65and
66.B ln
67is used if only two arguments are given, and the second argument is not a
68directory. The source and target file are then the two files given.
69.PP
70If the second synopsis form is used then the last argument must be a
71directory. Each of the files is copied, moved or linked into this directory.
72.PP
73A file is by default copied by
74.B cp
75without looking at its type, so symlinks are followed and devices are opened
76and read from or written to. Links between files are ignored. This
77behavior can be changed by using the proper options.
78.PP
79The
80.B mv
81utility uses the
82.BR rename (2)
83call to rename or move files. If source and target are on different devices
84however, then
85.B mv
86will use
87.B cp \-pr
88to copy the files or directory trees.
89.PP
90Each utility continues with the next file on errors, except on I/O errors.
91.SH OPTIONS
92.TP
93.B \-p
94Copy the file attributes like mode, owner, group and time of last
95modification. Normally only the mode is copied to a new file with the file
96creation mask applied. Setuid bits are cleared if setting the ownership
97fails.
98.TP
99.B \-i
100Ask if ok to overwrite, replace or remove.
101.B Mv
102and
103.B rm
104will ask this automatically if interactive and the target file is writable.
105.B Cp
106will fail if the target cannot be written,
107.B ln
108will always fail if the target exists.
109.TP
110.B \-f
111Makes
112.B cp
113remove a target file before copying if it is not writable,
114.B mv
115removes an existing target without asking,
116.B rm
117does not report any errors, and
118.B ln
119removes an existing target file before linking. The last of
120.B \-i
121and
122.B \-f
123wins for
124.B mv
125if both flags are set, the other utilities do something sensible, like asking
126before forcefully removing.
127.TP
128.B \-s
129Make a symlink instead of a normal link. For utilities other than
130.B ln
131this flag means "copy similar". The modified time is always copied for
132.B cp \-s
133and the other attributes are copied if a new file is created. The normal
134\s-2POSIX\s+2 required patronizing like applying the file creation mask or
135clearing setuid bits is not done.
136.TP
137.B \-S
138Make a symlink if a normal link cannot be made because source and target are
139on different devices. The symlink is required to really refer back to the
140source, meaning that a/b must exist in the call
141.BR "ln \-S a/b c/d" ,
142and that the symlink from c/d must lead back to a/b. So the symlink will be
143created as if
144.B "ln \-s ../a/b c/d"
145was called. If the target is a full path, but the source is not then an
146error will be given saying that this is "too difficult."
147.TP
148.B \-m
149Merge trees. The first synopsis form is assumed, and the files from one
150tree are merged into the other. There is no "if it's a directory the put
151it into that directory" trickery here.
152.TP
153.BR \-r ", " \-R
154Recursively copy, remove, or link. If the source is a directory then the
155files in this directory are copied to similarly named files in the target
156directory. Special files are copied as new special files, they are not read
157or written. Symlinks are still expanded and the link structure ignored with
158.BR \-R .
159The
160.B \-r
161flag does copy symlinks as symlinks and keeps the link structure intact.
162(Note that
163.B \-R
164is invented by \s-2POSIX\s+2 as a replacement for the classic
165.B \-r
166option of older copy commands that did read special files. The standard
167says that
168.B \-r
169is implementation defined, so that's why this flag is better than
170.B \-R
171in this implementation of
172.BR cp .)
173For
174.B rm
175and
176.B ln
177both flags mean the same.
178.B Ln
179will recursively link the files in the trees, except symlinks, they are
180copied. If symlinks are created with
181.B ln \-rs
182or
183.B ln \-rS
184then they are required "to work" as described with the
185.B \-S
186flag.
187.TP
188.B \-v
189Verbose. Show what is done on standard output.
190.TP
191.B \-x
192Do not cross mount points. Empty directories will be created if the source
193directory is a mount point on a copy, move or link. A mount point will not
194be removed or traversed recursively. This flag allows one to copy the root
195device, e.g.
196.BR "cpdir \-x / /mnt" .
197.SH "SEE ALSO"
198.BR cat (1),
199.BR mkdir (1),
200.BR rmdir (1),
201.BR mkdir (2),
202.BR rmdir (2),
203.BR link (2),
204.BR unlink (2),
205.BR rename (2),
206.BR open (2),
207.BR read (2),
208.BR write (2),
209.BR opendir (3).
210.SH NOTES
211All the utilities described are links to the same program.
212.SH BUGS
213.B Mv
214should first copy a tree across devices and then remove the source tree if
215there was no error. Instead, each file in the tree is copied and
216immediately removed. On error you may be left with two half-filled trees,
217together containing all of the files. You may have to restart the move with
218.BR "mv \-m" .
219.PP
220.B Rm
221should be able to remove arbitrarily deep trees.
222.SH AUTHOR
223Kees J. Bot (kjb@cs.vu.nl)
Note: See TracBrowser for help on using the repository browser.