SRC DEST
$ ls
test.txt
$ cat test.txt
this is a test
$ cp test.txt test2
$ cat test2
this is a test
如果目标存在:
$ echo abc > test.txt
$ cat test.txt
abc
$ cp test.txt test2
$ cat test2
abc
$ pwd
/home/centos/Downloads
$ cd ../Documents/
$ cp test.txt ../Downloads/test.txt
$ cat ../Downloads/test.txt/test.txt
abc
SRC是多个文件
$ cp test* ../Downloads/test.txt/test.txt
cp: target `../Downloads/test.txt/test.txt‘ is not a directory
$ cp -r Documents/ Downloads/abc
$ ls Downloads/abc/
test2 test.txt
$ cp -i test2 ../Downloads/abc/test2
cp: overwrite `../Downloads/abc/test2‘? y
$ cp Documents/ Downloads/
cp: omitting directory `Documents/
$ cp -r Documents/ Downloads/
-a: 归档复制 相当于-dR --preserve=all
-d: --no-deference --preserve=links
--preserve=[ATTR_LIST]
mode: 权限
ownership
timestamp
links
xattr
context
all
mv [OPTION]... [-T] SOURCE DEST
mv [OPTION]... SOURCE... DIRECTORY
mv [OPTION]... -t DIRECTORY SOURCE...
如果SRC是单个文件:
$ mv Documents/test2 Music/
$ mv Documents/test.txt Downloads/abc/test.txt
rm [OPTION]... FILE...
options
原文:http://blog.51cto.com/13509526/2162054