Tar is the best tool to pack an archive and Gzip is the most widely used archive type when using Linux and this is a short tutorial on how to do it.
Creating a tar.gz archive
tar pczf archive.tar.gz /home/document
This command would create archive.tar.gz from all the files in found in /home/document.
p - preserving the attributes of the files
c - creating the archive
z - using gzip
f - using a file name
Extracting a tar.gz archive
tar xzf archive.tar.gz -C /home/document
This command would extract archive.tar.gz to the document folder.
x - extract command
z - extract using gzip
f - file name mentioned
C - the directory in which it should be extracted. Not adding it would make it extract it in the current directory.
Adding v (verbose) would list all the files and directories getting extracted during the process as well.
If you want to extract just one file out of the archive, you just need to add it at the end:
tar xzfv archive.tar.gz file.txt
Archiving and extracting with Tar & Gzip Print
- tar, extract, gzip, archiving
- 2
Was this answer helpful?
Related Articles
What happens if I go over my bandwidth limit?
You will get a notification when you've reached 90% of your allocated bandwidth. If you reach the...
How do I add more bandwidth?
There are two ways you can add more bandwidth.1.) You can upgrade your account to add more...
How does DDoS protection work?
We provide DDoS filtering up to 10 Gbps included with all of our VPS plans at all locations. If...
Do you create backups of the VPS?
We do a snapshot backup of every VPS to dedicated backup server. This snapshot backup is for...
How do i set reverse DNS (PTR) on my ip address?
In order to set rDNS on your IP please open a ticket to our support department and we will apply...