Compress multiple files:
tar -czvf name-of-archive.tar.gz file1 file2 folder1 folder2
Compress folder:
tar -czvf name-of-archive.tar.gz /path/to/directory-or-file
Compress a folder while excluding some files:
tar -czvf archive.tar.gz /home/ubuntu --exclude=*.mp4
Decompress tar.gz file:
tar -xzvf archive.tar.gz
tar -xzvf archive.tar.gz -C targetDir
tar -xzvf archive.tar.gz -directory targetDir
Souce:
https://www.howtogeek.com/248780/how-to-compress-and-extract-files-using-the-tar-command-on-linux/