Tar Cheat Sheet
Compress a file or directory
tar -czvf name-of-archive.tar.gz /path/to/directory-or-file
- -c: Create a new archive. Arguments supply the names of the files to be archived. Directories are archived recursively, unless the —no-recursion option is given.
- -z: Use gzip.
- -v: Use archive file.
- -f: Specify the filename of the archive.
Extract an archive
tar -xvzf name-of-archive.tar.gz
- f: Specify archive file.
- z: Use gzip.
- x: Extract files from an archive.
- v: Verbosely list files processed.