...
Create linux tar gz (Gzip) archive
tar -cvfz czvf myarchive.tar.gz ./mydirectory/
Note |
---|
The f flag must come at the end or you will get an error. |
Here is what each flag does,
Panel |
---|
-c, –create create a new archive
|
...
Extract linux tar gz (Gzip) archive ,and note the The f flag must come at the end or you will get an error.
Code Block | ||
---|---|---|
| ||
tar -xzvf mystuff.tgz | ||
Note |
In some scenarios, you are moving between systems and want to extract maintaining permissions of users external to yourself. In this scenario you must ensure you UIDs are the same across systems,
Code Block | ||
---|---|---|
| ||
sudo tar -xzvf mystuff.tgz |
....
We use -x to extract the files form the tar archive
-x, –extract, –get extract files from an archive
...
Code Block | ||
---|---|---|
| ||
# To tar the directory
sudo tar -zcvpf tarfile.tar.gz ./folder/
# To untar and gunzip the file in one command
sudo tar -zxvpf tarfile.tar.gz
# Encrypting a tar
... |
...