The knowledge points of this article on how to decompress gz format files in Linux are not well understood by most people, so the editor summarizes the following content for you. The content is detailed, the steps are clear, and it has certain reference value. I hope you can read this article. This article can gain something, let's take a look at this article on how to decompress gz format files in linux.
In linux, you can use the gunzip command or the gzip command to decompress the gz format file. The gunzip command is used to decompress files compressed by gzip, that is, to decompress files with an extension of .gz, the syntax gunzip [options] file...; to decompress files compressed by gzip, you can also use gzip itself, that is, gzip - d compressed package.
The gunzip command in Linux can be used to decompress .gz compressed files. In fact, gunzip is the hard link of gzip, so whether it is compression or decompression, you can use the gzip command Done alone.
Linux gunzip command: decompress files or directories
gunzip is a widely used decompression command, which is used to decompress files compressed by gzip (extension .gz).
For decompressing files compressed by gzip, you can also use gzip itself, namely gzip -d
compressed package.
The basic format of the gunzip command is:
gunzip [options] file...
parameter | description |
---|---|
options | gunzip command use parameters. |
file | The name of the file to be decompressed. |
Common parameters of gunzip command
Parameter | Description th> |
---|---|
-a, --ascii | Use ASCII text mode. |
-c, --stdout, --to-stdout | outputs the decompressed file to the standard output device. |
-f, --force | Forcibly unpack compressed files, regardless of file names or existence of hard links and whether the file is a symbolic link. |
-l, --list | List information about compressed files. |
-L, --license | Display version and copyright information. |
-n, --no-name | When compressing files, do not save the original file name and timestamp. |
-N, --name | When compressing files, keep the original file name and timestamp. |
-q, --quiet | Suppress warning messages. |
-r, --recursive | Recursive processing, all files and subdirectories in the specified directory will be processed together. |
-t, --test | Test whether the compressed file is correct or not. |
-v, --verbose | Display the command execution process. |
Example 1] Decompress the file directly.
[root@localhost ~]# gunzip install.log.gz
Of course, "gunzip -r" is still only The files in the directory will be decompressed, not unpacked. To decompress the ".gz" format, you can also use the "gzip -d" command, for example:
[root@localhost ~]# gzip -d anaconda-ks.cfg .gz
[Example 2] To decompress the contents of the directory, you need to use the "-r" option, for example:
[root@localhost ~]# gunzip -r test/
Note, if we compress a plain text file, we can use it directly The zcat command looks at the contents of this text file without decompressing it. For example:
[root@localhost ~]# zcat anaconda-ks.cfg.gz
The above is the content of this article about how Linux decompresses gz format files. I believe everyone has a certain understanding. I hope the editor will share it The content is helpful to everyone. If you want to know more relevant knowledge content, please pay attention to the Yisu cloud industry information channel.
Copyright Description:No reproduction without permission。
Knowledge sharing community for developers。
Let more developers benefit from it。
Help developers share knowledge through the Internet。
Follow us