compress_entire_directory_to_tar_archive
This is an old revision of the document!
Compress Entire Directory to tar archive
Jul 2017
tar files are compressed files that contain all files and folders from a given location. The advantage to using .tar files, other than the obvious (potential) space saving is that you can include all file/folder permissions in the .tar file that would potentially be lost if you were doing a straight copy.
.tar Syntax
The basic syntax for tar is quite simple, here is an example:
tar -switches xxx.tar.gz ABC
There are many switches available for .tar, but the main ones we will be using are:
p == preserve permissions c == create archive v == verbose (print names while making tar) z == gzip f == tar file name
To create a .tar archive, where the file name is archive.tar and the target folder is /home/work we would use the following syntax.
tar -pcvzf archive.tar /home/work
compress_entire_directory_to_tar_archive.1499931881.txt.gz · Last modified: 2023/03/09 22:35 (external edit)