Linux foundation -05- text processing, tar, unzip

1. longitudinal combined command file using the cat
1) The combined use cat achieve vertical file:
a) For example: Use cat baby.age, baby.kg baby.sex three files and merged into longitudinal baby method of file:
cat baby.age baby.kg baby.sex >baby
b) For example: Use cat baby.age add content file to the file baby2 method:
cat baby.age >>baby2
2. archive and archiving
1) Definition Archiving: Archiving (archiving) is to many files (or directory) packaged into one file.
2) archiving Purpose: The purpose is to facilitate the filing of backup, restore and file transfer operations.
3) function tar command: multiple files (may also include directory because the directory itself is a file) to be stored on a single tape or disk archive together. And the future can restore only some of the specified files in the archive as needed.
4) common options for the tar command:
c: Create a new tar file.
t: lists the contents of the tar file in the directory.
x: extracting files from the tar file.
f: Specifies the archive file or tape (it may be a floppy disk) device (generally required to choose).
v: The details of the package file is displayed, v is the first letter verbose.
z: Use gzip compression algorithm to compress the file package.
j: Use bzip2 compression algorithm to compress the file package.
3. Use the tar command to create, view and extract archive files
1) create an archive using the tar command usage example:
For example: Use tar arch packaged into an archive directory named arch.tar a method (packaging requires that all of the files and directories):
tar cvf Archktr Arch
Use the tar command to view the archive file usage example:
For example: The method of using the tar command to display all the files in the archive arch.tar (package) of:
tar tf arch.tar
2) Use the tar command to extract the archive file usage example:
For example: Use the tar command to restore the entire contents of arch.tar method:
tar xvf arch.tar -C path
4. File Compression zipping
1) 压缩的定义:压缩就是将一个大的文件通过一些压缩算法变成一个小文件。
2) 压缩的目的:主要是缩小文件的大小,这样会节省存储文件的磁盘或磁带的空间,另外在网络上传输这些小文件也会减少网络的浏览(也就是节省网络的带宽)。
3) 解压缩的定义:解压缩就是将一个通过一些压缩算法的文件恢复到压缩之前的样子。
4) gzip命令和gunzip命令的用法举例:
a) 例如:将文件file1压缩成.gz格式的压缩包应该使用的命令为:gzip file1 –c > /路径/name.gz
b) 例如:将压缩文件file1.gz解压缩的命令为:
gunzip file1.gz >
5) bzip2命令和bunzip2命令的用法举例:
a) 例如:将文件file1压缩成.bz2格式的压缩包应该使用的命令为:bzip2 file1 >
b) 例如:将压缩文件file1.bz2解压缩的命令为:
bunzip2 file1.bz2 >
5. 在使用tar命令的同时进行压缩和解压缩
1) 掌握在使用tar命令的同时进行压缩和解压缩的用法举例
a) 例如:使用tar命令将arch目录打包而且同时使用gzip的技术压缩打包后文件的方法(打包后的文件名为arch.tar.gz):
tar cvfz arch.tar.gz arch
b) 例如:使用tar命令将arch目录打包而且同时使用bzip2的技术压缩打包后文件的方法(打包后的文件名为arch.tar.bz2):
tar cvfj arch.tar.bz2 arch

Guess you like

Origin www.cnblogs.com/lsf123456/p/11124712.html
Recommended