Compress and extract TAR files on linux
How to compress and extract TAR files on linux with gzip easily.
To compress just use this.
tar -czvf archive-name.tar.gz /directory-path-or-file
Options are:
- c: create
- z: compress with gzip
- v: verbose mode
- f: specify filename
To extract a compressed file just use this.
tar -xzvf archive-name.tar.gz
Or you can specify the directory where you want to extract.
tar -xzvf archive-name.tar.gz -C /var/www