What is the purpose of the gzip
command in UNIX?
a) To compress files
b) To extract files
c) To display file contents
d) To list files in a directory
Answer:
a) To compress files
Explanation:
The gzip
command in UNIX is used to compress files, reducing their size for more efficient storage and transfer. The compressed file has a .gz
extension. To compress a file, you simply run gzip filename
, and it creates filename.gz
.
To decompress a file, you can use the gunzip
command. For example, gunzip filename.gz
will restore the file to its original form. Compression helps save disk space and makes it easier to send files over the network.
Understanding how to use gzip
is important for managing disk space, especially in environments where storage and bandwidth are limited. It’s a valuable tool for anyone working with large files in UNIX.