If you want to compress files and directories or want to decompress them on Linux machine you can use different methods which you like. Compression always used to reduce the space of directory or file Also while you have to transfer file from one place to another you can use different types of algorithms and different type of file types. like .tar, .zip .gzip. and .rar to compress and transfer method for the remote locations compressed file will take less time.
During the compression you can also set password protection for the file which is more secure and no security risk for important data.
This is old tool and classic method, its good advantages fit for speed, compress +decompress with higher rate and it creates files with .gz extension.
Open Linux Terminal (Shortcut Key Alt+Ctrl+T)
For File Compression:
$ gzip compress_file
See output like ==>compress_file.gz
For Dirctory compression:
$ gzip -r compress_dir
To Extract it type:
Tar Archiving with Compression
Follow the same patterns to extract:
$ tar xJvf xzcompressed.tar.xz
Looking for more about then whats wrong with $ tar –help