Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music

All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => command , shell script ,tool , crontab => Topic started by: golfreeze on กันยายน 08, 2019, 02:46:33 PM

Title: archive file to .tgz
Post by: golfreeze on กันยายน 08, 2019, 02:46:33 PM
A tar.gz file and a .tgz file are similar.

Compress files using tar:

tar -cvzf <name of tarball>.tgz /path/to/source/folder
for example, I want to create a backup.tgz or backup.tar.gz from folder /home/user/project

tar -cvzf backup.tgz /home/user/project

tar -cvzf backup.tar.gz /home/user/project
You can use tar cvzf instead of tar -cvzf as well.

Extract .tgz or .tar.gz files using tar

tar -xvzf backup.tgz

tar -xvzf backup.tar.gz
Mnemonic for compression (the order of the flags do not matter)

C ompress
Z ee
F ile
V erbose
Mnemonic for extraction (the order of the flags do not matter)

e X tract
Z ee
F ile
V erbose