(I) Principles of compression technology:
-- Principle 1
Because 1 byte = 8 bit, each byte has 8 memory units, and each memory unit can be 0, 1. When we record the number 1, seven bits should be "null ". However, to meet the needs of our current OS data access,
Therefore, the data is converted into bytes for record. Some compression technologies are used to "resize" the space to reduce the space occupied by files.
-- Principle 2
Record duplicate data. For example, if your data has 100 records, the compression technology will record "100 records 1" instead of actually having 100 records 1 bits.
(Ii) Introduction to various compression commands I Gzip
Syntax:
Gzip [-DV] File Name
Parameters:
-D: extracted Parameters
-V: Display compression ratio
Example:
[root@localhost Desktop]# gzip show_space.sql [root@localhost Desktop]# gzip -d show_space.sql.gz
Ⅱ Bzip2
Syntax:
Bzip2 [-dkzv] File Name
Parameters:
-D: extract parameters.
-K: Keep the source file
-Z: Compression Parameters
-V: Display compression ratio
Example:
[root@localhost Desktop]# bzip2 -z show_space.sql [root@localhost Desktop]# bzip2 -d show_space.sql.bz2 [root@localhost Desktop]# bzip2 -zk show_space.sql
Ⅲ tar
Whether or not the files packaged by tar are compressed is named differently.
For example, tar-CV-F file.tar. This file is called tarfile.
For example, tar-JCV-F file.tar.bz2. This file is called tarball)
Syntax:
Compression: name of the file or directory to be compressed by tar-JCV-F filename.tar.bz2
Query: tar-jtv-F filename.tar.bz2
Decompress: tar-jxv-F filename.tar.bz2-C directory to be decompressed
If it is .gz, change J to Z.
Example:
[root@localhost Desktop]# tar -jcv -f think.tar.bz2 show_space.sql show_space.sql[root@localhost Desktop]# tar -jxv -f think.tar.bz2 -C /root/Desktopshow_space.sql
IV cpio
CIPO and data stream redirection
Syntax:
Backup: cpio-ovcb>
Restoration: cpio-ivcdu <
Example:
[root@localhost Desktop]# find | cpio -ovcB > /home/oracle/desktop.cpio[root@localhost Desktop]# cpio -idvc /home/think < /home/oracle/desktop.cpio