Compressed in GZIP format, GZIP format decompression

Compressed in GZIP format, GZIP format decompression

GZIP is the most commonly used compression method for files on Linux.
It is usually used to reduce the size of a file by compressing it into a single (archived) file using the tar command.

●Compression of tar files

1.Archive temp directory to temp.tar file

[root@Lion ~]# tar cvf temp.tar temp
temp/
temp/test_txt
temp/test_txt2
temp/test_dir/
temp/test_dir2/
temp/list.txt
temp/list.txt~
temp/list2.txt

[root@Lion ~]# ls -l temp.tar
-rw-r–r– 1 root root 10240 Jun 30 19:48 temp.tar

2.Compress the temp.tar file in GZIP format
[root@Lion ~]# gzip temp.tar
[root@Lion ~]# ls -l temp.tar.gz
-rw-r–r– 1 root root 432 Jun 30 19:48 temp.tar.gz

●Decompress files compressed in GZIP format

Decompress and undo a file that has been compressed in GZIP format. To undo, use the gunzip command.

Unzip the temp.tar.gz file
[root@Lion ~]# gunzip temp.tar.gz
[root@Lion ~]# ls -l temp.tar
-rw-r–r– 1 root root 204258 Sep 8 2007 temp.tar
タイトルとURLをコピーしました