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
- 0 Users Found This Useful
MTR is a network diagnostic tool that combines traceroute and ping utilities. It enables system...
Finding files and content in the command line can be tricky sometimes, but with a bit know...
Connecting to your MySQL server via SSH can be very useful for developers and system admins and...
Connecting to your Linux server via SSH is usually done via Putty at...
One very important tool that Unix provides is the grep command, which processes files line by...