Create Time: 201707092356
Update Time: 201707100021
//////////////////////////////////////////
1. ar
2. tar
3. compress
4. cpio
与tar相似cpio将文件归档到硬盘或磁带等存储设备中。在所处理的文件类型方面,它比tar更全面,但也更复杂。cpio在tar更为可靠,因为如果一个tar文件中某处有一个坏块,就不能对备份文件的其它部分进行访问,而使用cpio则只有坏块不能被访问,其他部分照样可以被访问。
4.1 Copy-Out Mode Syntax:
In copy-out mode, cpio copies files into an archive. It reads a list of filenames, one per line, on the standard input and writes the archive onto the standard output. A typical way to generate the list of filenames is with the find command;
4.2 Copy-In Mode Syntax:
In copy-in mode, cpio copies files out of an archive or lists the archive contents. It reads the archive from the standard input. Any non-option command line arguments are shell globbing patterns; only files in the archive whose names match one or more of those patterns are copied from the archive.
4.3 Copy-Pass Mode Syntax:
In copy-pass mode, cpio copies files from one directory tree to another, combining the copy-out 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.
### 当创建归档文件时,cpio从标准输入读取要备份的文件列表,
### 然后把生成的归档文件到标准输出,文件列表一般使用find或ls生成.
### cpio默认不会创建目录(-d),而且默认不会覆盖已有文件(-u)
### 备份整个目录树
% find . -print -depth | cpio -ov > tree.cpio
### 备份当前目录
% ls | cpio -ov > directory.cpio
5. dd
6. gzip/bzip2
默认不保留源文件,可使用gzip -c file > file.gz保留源文件
7. zcat/bzcat
可查看.gz文件内容
Reference:
[cpio zh]http://onlyzq.blog.51cto.com/1228/517896 [cpio en]https://www.computerhope.com/unix/ucpio.htm 3.