Using .tgz files 1
Create
To create a .tgz
file, we used
tar
with the following parameters -czf
:
-c
or--create
will create a new archive.-z
– or--gzip
or--gunzip
or--ungzip
will filter the archive throughgzip
and compress it.-f
or--file=ARCHIVE
will use archive file or device ARCHIVE. If this option is not given,tar
will first examine the environment variableTAPE
. If it is set, its value will be used as the archive name. Otherwise, tar will assume the compiled-in default.
Example:
tar -czf $ARCHIVE_FILE_NAME.tgz $PATH_TO_COMPRESS;
Please note that the order of the parameters will not change the result.
Extract
To extract a .tgz
or .tar.gz
file using tar
we used the following parameters -xzf
:
-x
or--extract
--get
will extract the files from the archive. Arguments are optional. When given, they specify names of the archive members to be extracted.-z
– or--gzip
or--gunzip
or--ungzip
will filter the archive throughgzip
and decompress it.-f
or--file=ARCHIVE
will use archive file or device ARCHIVE. If this option is not given,tar
will first examine the environment variableTAPE
. If it is set, its value will be used as the archive name. Otherwise, tar will assume the compiled-in default.
Example:
tar -xzf $ARCHIVE_FILE_NAME.tgz;