Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Linux Commands»3 Most Popular Tools to Archive Files and Directories in Linux

    3 Most Popular Tools to Archive Files and Directories in Linux

    RahulBy RahulNovember 22, 20142 Mins Read

    There are multiple tools available in Linux system for creating archive files. In this article you will find uses of multiple tools for creating or extracting archive files through command line


    Tool 1 – Zip

    zip is the most popular command line archiving utility for Linux systems.

    Create Archive of File

    # zip output.zip /var/log/*.log
    

    Create Archive of Directory

    # zip -r output.zip /var/log
    

    Extract Archive

    # unzip output.zip
    

    Tool 2 – Tar

    Tar is the another most popular command line archiving utility for Linux systems.

    Create Archive of File

    # tar -cf output.tar /var/log/*.log
    

    Create Archive of Directory

    # zip -cf output.tar /var/log
    

    Extract Archive

    # tar -xf output.tar
    

    Tool 3 – Gzip

    Gzip is one more tool for command line users for making archive files. Gzip also supports to take input of data as standard input or through pipe and create zip file.

    Create Archive of File

    # gzip -k access.log
    

    Create zip file of piped data

    # cat /var/log/messages | gzip > messages.gz
    

    Extract Archive

    # gunzip access.log.gz
    

    Combined – Tar + Gzip

    Tar also combined gzip program to enable higher compression level of files. Uisng tar with gzip created files extension will be .tar.gz.

    Create Archive of File

    # tar -czf output.tar.gz /var/log/*.log
    

    Create Archive of Directory

    # zip -czf output.tar.gz /var/log
    

    Extract Archive

    # tar -xzf output.tar.gz
    
    archive compress gzip tar zip
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Install MariaDB 10 on Ubuntu 18.04 And 16.04 LTS
    Next Article Reading File Line by Line in Linux Shell Script

    Related Posts

    How to Search Recently Modified Files in Linux

    2 Mins Read

    Bash Printf Command

    Updated:December 23, 20212 Mins Read

    Tee Command in Linux with Examples

    4 Mins Read

    How to Scan Open Ports with Nmap

    5 Mins Read

    Handling filenames with spaces in Linux

    3 Mins Read

    How To Compare Two Files in Linux

    Updated:August 23, 20215 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install Ionic Framework on Ubuntu 22.04
    • What is the /etc/hosts file in Linux
    • How to Install Angular CLI on Ubuntu 22.04
    • How to Install Composer on Ubuntu 22.04
    • How to Create DMARC Record For Your Domain
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.