Home Tar, Gzip and Gunzip
Post
Cancel

Tar, Gzip and Gunzip

gzip and gunzip Command

  • to zip a file
    1
    2
    
      Syntax: <br/>
          gzip <file_name> 
    
  • to unzip a file
    1
    2
    3
    4
    
      Syntax: <br/>
          gunzip <file_name>
              OR
          gzip -d <file_name>
    

tar Command

  • To convert an entire directory into an archive file.
  • different options available in with tar are:-
    • c: compress
    • f: file
    • x: extract
    • t: list the content of archive
      1
      2
      3
      4
      
      Syntax: <br/>
          tar cvf <filename>.tar file_path/folder_path
      Output: 
          This creates an archive file with extension `.tar`
      

      Tar file is then compressed using gzip with extension filename.tar.gz

  • To decompress and unzip a tar file
    1
    2
    
      Syntax: <br/>
          tar xvf <name.tar.gz>
    

tar and zip at the same time

1
2
3
4
    Syntax: <br/>
        tar -zcvf <filename>.tar.gz file_path
                    And
        tar -zxvf <filename>.tar.gz
This post is licensed under CC BY 4.0 by the author.