Linux gzip
gzip is a Linux command-line utility used for file compression and decompression. It's commonly used to compress large files to save disk space or to transfer files over the internet more quickly. Here's how to use gzip in Linux:
- Compress a file: To compress a file using gzip, use the "gzip" command followed by the name of the file you want to compress. For example, to compress a file called "file.txt", use the following command:
gzip file.txt
This will create a compressed file called "file.txt.gz" in the same directory.
- Decompress a file: To decompress a gzip-compressed file, use the "gunzip" command followed by the name of the compressed file. For example, to decompress the "file.txt.gz" file created in the previous step, use the following command:
gunzip file.txt.gz
This will create a decompressed file called "file.txt" in the same directory.
- Compress multiple files: To compress multiple files, use the "gzip" command followed by the names of the files you want to compress. For example, to compress all files in the current directory with a ".txt" extension, use the following command:
gzip *.txt
This will create a compressed file for each file with a ".txt" extension.
- Decompress multiple files: To decompress multiple files, use the "gunzip" command followed by the names of the compressed files. For example, to decompress all files in the current directory with a ".txt.gz" extension, use the following command:
gunzip *.txt.gz
This will create a decompressed file for each file with a ".txt.gz" extension.
gzip is a simple and powerful command-line tool for file compression and decompression in Linux. It's commonly used to compress large files or to transfer files over the internet.
Comments
Post a Comment