The gzip command
1. Compress a file
Action:
Details:
Command:
[root@academy mydir]# truncate -s 20M myfile.txt
[root@academy mydir]# ls -ltrh
total 0
-rw-r--r--. 1 root root 20M Dec 22 23:00 myfile.txt
[root@academy mydir]# gzip myfile.txt
[root@academy mydir]# ls -ltrh
total 20K
-rw-r--r--. 1 root root 20K Dec 22 23:00 myfile.txt.gz
[root@academy mydir]#
2. Decompress a file
Action:
Details:
Command:
3. Compress multiple files:
Action:
Details:
Command:
4. Decompress multiple files:
Action:
Details:
Command:
5. Compress a directory:
Action:
Details:
Command:
6. Decompress a directory:
Action:
Details:
Command:
Last updated