User Tools

Site Tools


compress_entire_directory_to_tar_archive

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
compress_entire_directory_to_tar_archive [2017/07/13 08:35] – created walkeradmincompress_entire_directory_to_tar_archive [2023/03/09 22:35] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Compress Entire Directory to tar archive ====== ====== Compress Entire Directory to tar archive ======
 +<color #db5f0b>Jul 2017</color>
 +\\ 
 +\\ 
 +
 +----
 +<color #ed1c24>tar</color> 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 <color #ed1c24>.tar</color> file that would potentially be lost if you were doing a straight copy.
 +\\ 
 +\\ 
 +
 +----
 +
 +==== Create .tar File ====
 +\\ 
 +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:
 +<file>
 +p == preserve permissions
 +c == create archive
 +v == verbose (print names while making tar)
 +z == gzip
 +f == tar file name
 +</file>
 +\\ 
 +To create a <color #ed1c24>.tar</color> 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
 +\\ 
 +
 +----
 +==== Decompress .tar File ====
 +\\ 
 +To decompress the <color #ed1c24>.tar</color> file, we use the same tar command, we must use the same switches if we wish to preserve the file/folder structure and the file/folder permissions (permissions are very important).
 +\\ 
 +\\ 
 +To decompress the archive.tar file we created earlier, use the following command:
 +\\ 
 +    tar -pcvzf archive.tar
 +\\ 
 +
 +
  
compress_entire_directory_to_tar_archive.1499931322.txt.gz · Last modified: 2023/03/09 22:35 (external edit)