cp -r 和 cp -R 的区别
生活随笔
收集整理的這篇文章主要介紹了
cp -r 和 cp -R 的区别
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
今天倒騰linux根文件系統(tǒng)的時(shí)候發(fā)現(xiàn) cp -r?/dev /dev_bak 時(shí),竟然會(huì) 將磁盤設(shè)備中的數(shù)據(jù)進(jìn)行一次拷貝,而不是僅僅建立設(shè)備文件。
于是到網(wǎng)上搜了一把,收獲不小。
http://www.loveunix.net/html/200407/33920.html
這里有人問同樣的問題,某人用英文作答:
-r Copies file hierarchies under the file or directory specified by the SourceFile or SourceDirectory parameter (recursive copy).?The -r flag processes special files in the same manner as regular files.?
-R Copies file hierarchies under the regular files and directories from the directory specified by the SourceFile or SourceDirectory parameter to the directory specified by the TargetDirectory parameter.?Special file types, such as first-in, first-out (FIFO) files and block and character device files, are re-created instead of copied.Symbolic links are followed unless the -h flag is specified. (The -R flag is preferred to the -r flag.) ? 這個(gè)回答已經(jīng)是很明白了, ? ?cp -r 會(huì)把所有source當(dāng)作普通文件(regular文件); ?而cp -R 對(duì)特殊文件(管道文件,塊設(shè)備文件,字符設(shè)備文件)會(huì)進(jìn)行創(chuàng)建操作,而不是拷貝。 其實(shí),以前我也看到過關(guān)于cp -r 和cp -R 的區(qū)別說明,只不過當(dāng)時(shí)我沒有遇到具體的情景,所以沒有在意。
-R Copies file hierarchies under the regular files and directories from the directory specified by the SourceFile or SourceDirectory parameter to the directory specified by the TargetDirectory parameter.?Special file types, such as first-in, first-out (FIFO) files and block and character device files, are re-created instead of copied.Symbolic links are followed unless the -h flag is specified. (The -R flag is preferred to the -r flag.) ? 這個(gè)回答已經(jīng)是很明白了, ? ?cp -r 會(huì)把所有source當(dāng)作普通文件(regular文件); ?而cp -R 對(duì)特殊文件(管道文件,塊設(shè)備文件,字符設(shè)備文件)會(huì)進(jìn)行創(chuàng)建操作,而不是拷貝。 其實(shí),以前我也看到過關(guān)于cp -r 和cp -R 的區(qū)別說明,只不過當(dāng)時(shí)我沒有遇到具體的情景,所以沒有在意。
總結(jié)
以上是生活随笔為你收集整理的cp -r 和 cp -R 的区别的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于cp命令中拷贝所有的写法
- 下一篇: Makefile选项CFLAGS,LDF