Let's think about it this way for a second
tar (tape archive) bundles multiple folders/files together into a single archive file — on its own it just 'bundles' without compressing, which is why it's usually paired with gzip, and that's why you see the .tar.gz extension (a tarball) so often. tar -czvf archive.tar.gz folder/ combines the flags c (create), z (gzip compression), v (verbose, lists the files), and f (specify a filename) — you can remember it with the mnemonic 'create zipped verbose file.' To extract (unpack), run tar -xzvf archive.tar.gz (x = extract). zip/unzip is the go-to when you need compatibility with Windows users (the .zip format).
Let's connect it to a real scenario
When taking a server backup, it's common to package an entire folder with tar -czvf backup-2026-08-23.tar.gz /var/www/mysite and then pull it down to your local machine with scp — instead of transferring a thousand files one by one, you just transfer a single archive, which is much faster. If you want to send website files to a client, zip -r website.zip website/ is handy since Windows users can just double-click to open it.
Let's try it together in the terminal
tar -czvf backup.tar.gz project/
tar -xzvf backup.tar.gz
zip -r website.zip website/
unzip website.zipAfter tar -czvf, a file called backup.tar.gz shows up in the folder, and you can check its size with ls -lh.5-minute try-it
Try archiving a practice folder with tar -czvf practice.tar.gz practice/. Use ls -lh to compare the archive's size against the original folder.
One thing to watch out for
Running tar -xzvf inside a directory that has important files in it can overwrite existing files with the ones in the archive — it's much safer to move into a fresh, empty folder before extracting.