Using tar and gzip91
Let’s use gzip to compress a file. We can copy /etc/services and compress it:
[root@rhel-instance tmp]# cp /etc/services .[root@rhel-instance tmp]# ls -lh services-rw-r--r--. 1 root root K Jun 23 2020 services[root@rhel-instance tmp]# gzip services[root@rhel-instance tmp]# ls -lh services.gz-rw-r--r--. 1 root root K Feb 17 20:16 services.gzPlease
note that when using gzip, this will compress the specified file, adding the .gz
extension to it, and the original file will not be kept. Also, be aware that the newly created file is one fifth of the size of the original file.
To recover it, we can run gunzip:
Share with your friends: