tar make tar.gz file with content of the folder code example

Example 1: gzip folder with tar

# gzip my-folder-name
#
# flags:
# 	z = filter the archive through gzip
# 	c = create a new archive
# 	v = verbosely list files processed
# 	f = use archive file or device ARCHIVE
#
# Example:
tar -zcvf my-filename.tar.gz my-folder-name

Example 2: compress folder in tar.gz unix

#Compress a folder in tar.gz format
tar -zcvf final_archive.tar.gz folder_to_compress/

#Multicore compression using pigz (can be installed with: conda install -c anaconda pigz)
tar cf - ./folder_to_compress/ | pigz -9 -p NPROC > final_archive.tar.gz

Tags:

Misc Example