cp.1
来自「minix操作系统最新版本(3.1.1)的源代码」· 1 代码 · 共 224 行
1
224 行
.TH CP 1.SH NAMEcp, mv, rm, ln, cpdir, clone \- copy, move, remove, link.SH SYNOPSIS.B cp.RB [ \-pifsmrRvx ].I file1 file2.br.B cp.RB [ \-pifsrRvx ].IR file " ... " dir.PP.B mv.RB [ \-ifsmvx ].I file1 file2.br.B mv.RB [ \-ifsvx ].IR file " ... " dir.PP.B rm.RB [ \-ifrRvx ].IR file " ...".PP.B ln.RB [ \-ifsSmrRvx ].I file1 file2.br.B ln.RB [ \-ifsSrRvx ].IR file " ... " dir.PP.B cpdir.RB [ \-ifvx ].I file1 file2.PP.B clone.RB [ \-ifsSvx ].I file1 file2.SH DESCRIPTION.de SP.if t .sp 0.4.if n .sp..The utilities.BR cp ,.BR mv ,.BR rm ,and.B lndo basic file management: copying, renaming or moving, deletion, andcreating links. (The.B cpdirand.B cloneutilities are easy to use aliases for copying or linking whole trees.They are the same as.B cp \-psmrand.BR "ln \-fmr" ).PPThe first synopsis form of the utilities.BR cp ,.BR mv ,and.B lnis used if only two arguments are given, and the second argument is not adirectory. The source and target file are then the two files given..PPIf the second synopsis form is used then the last argument must be adirectory. Each of the files is copied, moved or linked into this directory..PPA file is by default copied by.B cpwithout looking at its type, so symlinks are followed and devices are openedand read from or written to. Links between files are ignored. Thisbehavior can be changed by using the proper options..PPThe.B mvutility uses the.BR rename (2)call to rename or move files. If source and target are on different deviceshowever, then.B mvwill use.B cp \-prto copy the files or directory trees..PPEach utility continues with the next file on errors, except on I/O errors..SH OPTIONS.TP.B \-pCopy the file attributes like mode, owner, group and time of lastmodification. Normally only the mode is copied to a new file with the filecreation mask applied. Setuid bits are cleared if setting the ownershipfails..TP.B \-iAsk if ok to overwrite, replace or remove..B Mvand.B rmwill ask this automatically if interactive and the target file is writable..B Cpwill fail if the target cannot be written,.B lnwill always fail if the target exists..TP.B \-fMakes.B cpremove a target file before copying if it is not writable,.B mvremoves an existing target without asking,.B rmdoes not report any errors, and.B lnremoves an existing target file before linking. The last of.B \-iand.B \-fwins for.B mvif both flags are set, the other utilities do something sensible, like askingbefore forcefully removing..TP.B \-sMake a symlink instead of a normal link. For utilities other than.B lnthis flag means "copy similar". The modified time is always copied for.B cp \-sand the other attributes are copied if a new file is created. The normal\s-2POSIX\s+2 required patronizing like applying the file creation mask orclearing setuid bits is not done..TP.B \-SMake a symlink if a normal link cannot be made because source and target areon different devices. The symlink is required to really refer back to thesource, meaning that a/b must exist in the call.BR "ln \-S a/b c/d" ,and that the symlink from c/d must lead back to a/b. So the symlink will becreated as if.B "ln \-s ../a/b c/d"was called. If the target is a full path, but the source is not then anerror will be given saying that this is "too difficult.".TP.B \-mMerge trees. The first synopsis form is assumed, and the files from onetree are merged into the other. There is no "if it's a directory the putit into that directory" trickery here..TP.BR \-r ", " \-RRecursively copy, remove, or link. If the source is a directory then thefiles in this directory are copied to similarly named files in the targetdirectory. Special files are copied as new special files, they are not reador written. Symlinks are still expanded and the link structure ignored with.BR \-R .The.B \-rflag does copy symlinks as symlinks and keeps the link structure intact.(Note that.B \-Ris invented by \s-2POSIX\s+2 as a replacement for the classic.B \-roption of older copy commands that did read special files. The standardsays that.B \-ris implementation defined, so that's why this flag is better than.B \-Rin this implementation of.BR cp .)For.B rmand.B lnboth flags mean the same..B Lnwill recursively link the files in the trees, except symlinks, they arecopied. If symlinks are created with.B ln \-rsor.B ln \-rSthen they are required "to work" as described with the.B \-Sflag..TP.B \-vVerbose. Show what is done on standard output..TP.B \-xDo not cross mount points. Empty directories will be created if the sourcedirectory is a mount point on a copy, move or link. A mount point will notbe removed or traversed recursively. This flag allows one to copy the rootdevice, e.g..BR "cpdir \-x / /mnt" ..SH "SEE ALSO".BR cat (1),.BR mkdir (1),.BR rmdir (1),.BR mkdir (2),.BR rmdir (2),.BR link (2),.BR unlink (2),.BR rename (2),.BR open (2),.BR read (2),.BR write (2),.BR opendir (3)..SH NOTESAll the utilities described are links to the same program..SH BUGS.B Mvshould first copy a tree across devices and then remove the source tree ifthere was no error. Instead, each file in the tree is copied andimmediately removed. On error you may be left with two half-filled trees,together containing all of the files. You may have to restart the move with.BR "mv \-m" ..PP.B Rmshould be able to remove arbitrarily deep trees..SH AUTHORKees J. Bot (kjb@cs.vu.nl)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?