It is quite easy to create and to extract tar files on OS X or Linux via command line if you know how the syntax. Here is a small guide on how to create tar file and how to extract tar files. Previously we published a guide on how to get a Tar Extract Progress Bar in Linux and OS X. We recommend to read the article first as there are quite helpful information about tar and related links on that guide.
Commands to Create and Extract tar File
You can run man tar
command to read the manual entry for tar. To remember in easy way, the acronyms are for :
c : Create a tar
v : Verbose output
f : Extract tar ball
x : Extract all files from the archive
t : Display the contents of a tar
---
So, on server, after running wget command to get wordpress tar ball, to extract, we run :
1 | tar -xzvf latest.tar.gz |
that becomes a way to extract tar.
To create a tar, we have to run :
1 2 3 | tar -cvf this-archive.tar /path/to/directory/to/be/tar/ # or tar -cvf this-archive.tar /path/to/directory/to/be/tar/filename/ |