频道栏目
首页 > 资讯 > Linux > 正文

[CLI] 压缩备份相关命令汇总

17-07-10        来源:[db:作者]  
收藏   我要投稿
//////////////////////////////////////////

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.

相关TAG标签
上一篇:vim剪切指定内容
下一篇:CSS3新特性[转]
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站