How to use gzip Compression Command
Editor to share with you how to use the gzip compression command, I hope you will learn a lot after reading this article, let's discuss it together!
How to use the gzip compression command: [gzip [options] source file], such as [gzip install.log]. Gzip is a command that is often used to compress and decompress files in linux systems.
Gzip is a command that is often used to compress and decompress files in Linux systems. New files are compressed by this command, and the extension is usually marked ".gz".
Video tutorial recommendation: linux video tutorial
The basic format of the gzip command is as follows:
[root@localhost ~] # gzip [options] source file
Basic compression
The gzip compression command is so simple that you don't even need to specify the compressed package name, just the source file name. Let's try this:
[root@localhost ~] # gzip install.log# compressed instal.log file [root@localhost ~] # lsanaconda-ks.cfg install.log.gz install.log.syslog# compressed file is generated, but the source file also disappears
Preserve source file compression
When you compress a file using the gzip command, the source file disappears, resulting in a compressed file. At this time, some people will have obsessive-compulsive disorder, forced to ask the author: can not let the source file disappear when compressing the file? Well, that's okay, but it's awkward.
[root@localhost ~] # gzip-c anaconda-ks.cfg > anaconda-ks.cfg.gz# uses the-c option, but instead of exporting compressed data to the screen, it is redirected to a compressed file, so that the file can be shrunk without deleting the source file [root@localhost ~] # lsanaconda-ks.cfg anaconda-ks.cfg.gz install.log.gz install.log.syslog#. You can see that both the compressed file and the source file exist after reading this article. I believe you have a certain understanding of the use of the gzip compression command, want to know more related knowledge, welcome to follow the industry information channel, thank you for reading!