Organizational Research By

Surprising Reserch Topic

tar

Tar is a program that archives files into a single package that you can move around easily. After using the tar command ,you are left with a single tar file which is referred to as a âtarballâ. A tarball is compressed ,but you can compress it further by adding the âzâ flag which gzips it into a smaller file. This is how I typically use tar:

tar cvzf mytarball.tgz .

The âcâ flag means âcreate a tarballâ, the âvâ flag stands for âverbose modeâ or âshow every file that is compressed as it happensâ, the âzâ flag means âgzip the tarball further (hence the .tgz extension instead of .tar)â and the âfâ flag means âuse the tarfile argument as the name of the tarfileâ. The argument âmytarball.tgzâ is the name of the file. You can name it whatever you like; the extension does not matter â I just like using .tgz. The last argument â.â means include all files in the current directory and all subdirectories. After running this command you now have a compressed âmytarball.tgzâ file. You can move this file around wherever you need it. If I needed to download an entire site via FTP I would run this command and then just download the single tarball rather than downloading many files individually.

The opposite of archiving is unarchiving (o rly?). To unarchive a gzipped tarball use the following:

tar xvzf mytarball.tgz

Itâs that simple. The flags are the same except you use âxâ instead of âcâ which means âextractâ. This will uncompress your tarball in the current directory you are in, maintaining the original directory hierarchy.