# Tarball and compress entire directory
π tar -zcvf archive-name.tar.gz directory-name
# Tarball and compress files individually
π tar -cvf file1 file2 dir3 | gzip > archive-name.tar.gz
# Extract contents of compressed tar file
π tar -zxvf archive-name.tar.gz
What options mean:
- z: Compress archive using gzip program
- c: Create archive
- v: Verbose i.e display progress while creating archive
- f: Archive file name
- x: Extract file