1 / 7

How to Create Tar gz File

The tar command in linux allow you to compress files and directories into tar.gz files known as tarballs. Here's how to create tar.gz file in linux. #linux #ubuntu #tarball #compression <br><br>Visit https://ubiq.co/tech-blog/how-to-create-tar-gz-file-in-linux/

Download Presentation

How to Create Tar gz File

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How to Create tar.gz file in Linux

  2. How to create tarball in Linux We will use thetar command to create tar.gz file in Linux. Here's the syntax $ tar -cvzf filename.tar.gz /path/to/file [paths to more files/directories] OR $ tar -cvzf filename.tar.gz /path/to/directory [paths to more files/directories] In the above command, the tar command is followed by options -cvzf, the filename of final tar.gz file to be created, followed by one or more paths to files/directories In the above command we mention the following options • c - creation of archive file • v - for verbose, meaning it will display the progress in terminal • z - gzip the archived .tar file • f - filename of archive file

  3. Example to Create tar.gz file Let us look at a few examples to create tar.gz file Here's the command to create tar.gz file (e.g sales_data.tar.gz) from a single file (e.g /home/ubuntu/sales_data.txt) $ tar -cvzf sales_data.tar.gz /home/ubuntu/sales_data.txt First tar command will create the archive .tar file and then compress it to create .tar.gz file. That is why you see 2 file extensions in a tarball.

  4. How to create a tar.gz file from a directory Here's the tar command to create tar.gz file from a directory (e.g /home/ubuntu/product/) $ tar -cvzf product.tar.gz /home/ubuntu/product/ /home/ubuntu/product/ /home/ubuntu/product/file1.txt /home/ubuntu/product/file2.exe /home/ubuntu/product/file3.pdf tar command will list contents of your directory that is being archived.

  5. How to Extract tar.gz file Here's the command to extract tar.gz file $ tar -xvf product.tar.gz /home/ubuntu/product/ /home/ubuntu/product/file1.txt /home/ubuntu/product/file2.exe /home/ubuntu/product/file3.pdf tar command will list the contents of your tar.gz file that is being extracted. In the above command, we use -x option for extraction, instead of using -c for compression. Other options are same as above.

  6. Extract Files to Specific Directory Here's the command to extract files to a specific directory (e.g /home/ubuntu/data) $ tar -xvf filename.tar.gz /path/to/dir $ tar -xvf product.tar.gz /home/ubuntu/data

  7. Thank You Visit for details https://ubiq.co/tech-blog/how-to-create-tar-gz-file-in-linux/

More Related