当前位置: 首页 > 工具软件 > GNU cpio > 使用案例 >

Linux: command: cpio

江丰羽
2023-12-01

介绍

[root@10 ~]# rpm -qf /usr/bin/cpio
cpio-2.12-11.el8.x86_64

http://www.gnu.org/software/cpio/manual

例子

一例cpio的使用例子,是不是感觉又学到了新东西?

real-install-headers-cpio:
	cd `${PWD_COMMAND}`/include-fixed ; \
	find . -print | cpio -pdum $(DESTDIR)$(libsubdir)/include-fixed

这个find加cpio的作用是将当前目录的文件及目录,原封不动的复制到另一个目录;这里需要注意,-pdum是四个参数,-p之后可以有d,u和m参数。-pdum的参数的意思是:
-p
In copy-pass mode, cpio copies files from one directory tree to another, combining the copyout and copy-in steps without actually using an archive. It reads the list of files to copy from the standard input; the directory into which it will copy them is given as a non-option argument. (非选项参数)
This mode is requested by the ‘-p’ (‘–pass-through’) command line option.
The following options are valid in copy-out mode:

‘-d’
‘–make-directories’
Create leading directories where needed.
‘-m’
‘–preserve-modification-time’
Retain previous file modification times when creating files.
‘-u’
‘–unconditional’
Replace all files unconditionally.

优点

那为什么不直接用cp命令?cpio的性能要好一些,要不然为什么开发出来呢?
https://stackoverflow.com/questions/2966409/cpio-vs-tar-and-cp/ ;;;一些讨论
https://community.hpe.com/t5/hp-ux-general/cp-vs-cpio/td-p/2508407 ;;; 一些讨论

 类似资料:

相关阅读

相关文章

相关问答