Example Uses Of The Gzip Command. Gnu zip (gzip) is a compression utility that reduces the size of selected files. (a part is delimited by dots.) if the name consists of small parts only, the longest parts are truncated.
How to use the Gzip command in Linux
Creating a compressed file [huupv@devopsroles ~]$ gzip filename.txt. You can also use the command to pass several files as arguments. Gzip command in linux with examples. Gzip file1 file2 file3 file1.gz, file2.gz, and file3.gz are the three compressed files created by the command above. It is a command that is often used in linux system to compress and decompress files. To compress the files file1, file2, and file3, for example, run the following command: Gzip will only attempt to compress regular files. Gzip command examples in linux. If we want to compress multiple files or a directory into a single compressed file, we need to create a.tar archive using the tar command and then compress the.tar archive. This is our second post on compression and archiving series.
Here is the gzip command that you can use to compress. Gzip command in linux with examples. It is most widely used compression tool in linux. Let’s use gzip to compress a single file: You can also pass multiple files as arguments to the command. It is supported by almost all the linux distributions and it is available for most of the unix/linux flavors. You just have to mention the name of the file along with the command. By executing this command, we will be able to read the contents of our compressed gzip file sample.txt example 3: By default, any file that you compress with the gzip command is replaced with a.gz file of the same name. Retain original file while using gzip command. In this tutorial we’ll cover the basics of how to use the gzip command.