3 cp, mv, rm, ln, cpdir, clone \- copy, move, remove, link
51 do basic file management: copying, renaming or moving, deletion, and
56 utilities are easy to use aliases for copying or linking whole trees.
62 The first synopsis form of the utilities
67 is used if only two arguments are given, and the second argument is not a
68 directory. The source and target file are then the two files given.
70 If the second synopsis form is used then the last argument must be a
71 directory. Each of the files is copied, moved or linked into this directory.
73 A file is by default copied by
75 without looking at its type, so symlinks are followed and devices are opened
76 and read from or written to. Links between files are ignored. This
77 behavior can be changed by using the proper options.
83 call to rename or move files. If source and target are on different devices
88 to copy the files or directory trees.
90 Each utility continues with the next file on errors, except on I/O errors.
94 Copy the file attributes like mode, owner, group and time of last
95 modification. Normally only the mode is copied to a new file with the file
96 creation mask applied. Setuid bits are cleared if setting the ownership
100 Ask if ok to overwrite, replace or remove.
104 will ask this automatically if interactive and the target file is writable.
106 will fail if the target cannot be written,
108 will always fail if the target exists.
113 remove a target file before copying if it is not writable,
115 removes an existing target without asking,
117 does not report any errors, and
119 removes an existing target file before linking. The last of
125 if both flags are set, the other utilities do something sensible, like asking
126 before forcefully removing.
129 Make a symlink instead of a normal link. For utilities other than
131 this flag means "copy similar". The modified time is always copied for
133 and 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
135 clearing setuid bits is not done.
138 Make a symlink if a normal link cannot be made because source and target are
139 on different devices. The symlink is required to really refer back to the
140 source, meaning that a/b must exist in the call
141 .BR "ln \-S a/b c/d" ,
142 and that the symlink from c/d must lead back to a/b. So the symlink will be
144 .B "ln \-s ../a/b c/d"
145 was called. If the target is a full path, but the source is not then an
146 error will be given saying that this is "too difficult."
149 Merge trees. The first synopsis form is assumed, and the files from one
150 tree are merged into the other. There is no "if it's a directory the put
151 it into that directory" trickery here.
154 Recursively copy, remove, or link. If the source is a directory then the
155 files in this directory are copied to similarly named files in the target
156 directory. Special files are copied as new special files, they are not read
157 or written. Symlinks are still expanded and the link structure ignored with
161 flag does copy symlinks as symlinks and keeps the link structure intact.
164 is invented by \s-2POSIX\s+2 as a replacement for the classic
166 option of older copy commands that did read special files. The standard
169 is implementation defined, so that's why this flag is better than
171 in this implementation of
177 both flags mean the same.
179 will recursively link the files in the trees, except symlinks, they are
180 copied. If symlinks are created with
184 then they are required "to work" as described with the
189 Verbose. Show what is done on standard output.
192 Do not cross mount points. Empty directories will be created if the source
193 directory is a mount point on a copy, move or link. A mount point will not
194 be removed or traversed recursively. This flag allows one to copy the root
196 .BR "cpdir \-x / /mnt" .
211 All the utilities described are links to the same program.
214 should first copy a tree across devices and then remove the source tree if
215 there was no error. Instead, each file in the tree is copied and
216 immediately removed. On error you may be left with two half-filled trees,
217 together containing all of the files. You may have to restart the move with
221 should be able to remove arbitrarily deep trees.
223 Kees J. Bot (kjb@cs.vu.nl)