How to: Tar / Zip Files & Directories

Examples:

tar cf mytar.tar mydirectory/

Create the tar file “mytar.tar” holding the entire directory subtree supported by the directory “mydirectory/”.

tar xvf mytar.tar

Extract (unpack) the tar file “mytar.tar” into the current directory with verbose printout.

tar cf – mydirectory/ | gzip -c > mytar.tar.gz
gunzip -c mytar.tar.gz | tar xf –

Examples piping tar and gzip together to either create a compressed tar file or unpack a compressed tar file. The Linux version of tar can do this using the -z option e.g.:-

tar zcf mytar.tar.gz
tar zxf mytar.tar.gz

December 4, 2014   873    Linux, SSH  
Total 0 Votes:
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?


Leave a Comment