The most common compressed archive file format in Linux is the tar.gz format. Tar file is an archive file format. Tar.gz is a compressed tar file.
How to create a compressed tar.gz file from a folder or file in Linux?
In order to create a compressed tar.gz archive from a folder/file we need to run the following tar command:
tar -czf new-tar-file-name.tar.gz file-or-folder-to-archive
Here is the command explanation:
- tar – the tar command.
- c – create new archive.
- z – compress the archive using gzip.
- f – use archive file.
- new-tar-file-name.tar.gz – the name of the tar.gz to create.
- file-or-folder-to-archive – the name of the folder we want to archive.