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

Advertisement

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
Share.
Leave A Reply

Exit mobile version