Image

Knowledge base → Creating and unpacking archives in Linux

[Virtual servers]
Date of publication: 18.10.2023

There are several types of archives; in Linux, the most commonly used formats are tar.gz and zip. Below we provide examples for working with archives.

Archives also significantly reduce the size of text files, such as scripts or database files.

1. Creating an archive

1.1 Creating a tar.gz archive

tar -czf archive.tar.gz /home/user1/folder

1.1.1 Launch and archive in the root folder

tar -czf archive.tar.gz *

1.2 Creating a zip archive

apt install zip
zip -r archive.zip /home/user1/folder

1.2.1 Archiving multiple files

zip -q archive.zip file1 file2 file3

2. Unpacking the archive

2.1 Unpacking tar.gz

tar -xzvf archive.tar.gz

2.2 Unpacking zip

apt install unzip
unzip whmcs-8.8.0-release.1.zip -d folder




No Comments Yet