← All posts

Working with tar, gzip, and gpg
February 18, 2010|Heath Schweitzer|1 min read|26 views|Last Updated June 18, 2026
Linux
Create an Archive
$ tar -cvf mydocs.tar mydocs/
$ gzip mydocs.tar
or in one step...
$ tar -zcvf mydocs.tgz mydocs/
Extract an Archive
$ tar -zxvf mydocs.tar.gz
Add to an Archive
$ tar -rvf mydocs.tar mydocs/some-folder
$ tar -rvf mydocs.tar mydocs/some-file.txt
List the Contents of an Archive
$ tar -tf mydocs.tar
Encrypt an Archive
gpg -c -o mydocs.tgz.gpg mydocs.tgz
Decrypt an Archive
gpg mydocs.tgz.gpg
If this post was useful, consider buying me a coffee ☕ with ₿itcoin — no account needed, any amount welcome.