Archives
Create
Combine many files and directories into a single t-archive file.
1tar cf "${archive}".tar ${dir}
You can remember this with the mnemonic 'Create File'.
Unfortunately, this stores the full file path, so making a tar archive of /etc/nginx/ will store etc/nginx (without the leading /).
It's often better to tell tar which path to start from using the -C flag.
1tar cf "${archive}".tar -C /etc/ nginx
Check the contents of your archive with:
1tar tf "${archive}".tar
If you want to store 'everything in a directory', then using * will not work, because it will target everything in the current directory.
Instead, you can store the target in a variable:
1files=$(ls /etc/nginx)
2tar cf "${archive}".tar -C /etc/nginx/ $file
Extract
Extract the tar archive with
1tar xf "${archive}".tar
You can remember this with the mnemonic 'eXtract File'.
Compress
Create a zip-compressed archive with the z flag.
1tar czf "${archive}".tgz -C /etc/nginx/ $file
You can use any file ending you want, but sane people like to use '.tgz' or '.tar.tgz'.