Select Page

ABIOLA RASP – Raspberries for African School Projects

Wie können wir helfen?

< Alle Themen
Print

Compress and decompress command

no-052 au-03

Install zip

You need to install zip packages, if you don’t have it. To install zip package, follow the instructions.

  1. Open Terminal
  2. Run below command

sudo apt-get update

3. To install zip package, run below command

sudo apt-get install zip

You have now zip package and can compress and decompress multiple file with zip command.

Compress with zip command

We want to compress Abiola_Images folder and abiola text file on the desktop and the output will be abiola_archive.zip.

  1. Open Terminal and go to file directories with cd command

cd Desktop/

2. Run below command to compress

zip -r abiola_archive.zip Abiola-Images/ abiolaHere is the output: abiola_archive.zip

3. Here is the output: abiola_archive.zip -r option allows you to traverse the whole directory structure recursively.

SYNTAX:  
zip OPTIONS ARCHIVE_NAME FILES

For our example;
OPTIONS: -r
ARCHIVE_NAME: abiola_archive.zip
FILES: Abiola_Images/ abiola

Decompress with unzip command

  1. Open Terminal
  2. Run below command

unzip abiola_archive.zip

3. Here is the output

SYNTAX:
unzip ARCHIVE_NAME 

For our example;
ARCHIVE_NAME: abiola_archive.zip

Compress with tar command

  1. Open Terminal
  2. Go to your file’s directory. (Here is Desktop/)

cd Desktop/

3. Run below command to compress with tar

tar -czvf abiola_archive.tar.gz Abiola-Images/ Abiola

4. Here is the output.

SYNTAX:
tar OPTIONS ARCHIVE_NAME FILES

For our example;
OPTIONS: -czvf    
-> c: Create an archive            
-> z: Compress the archive with gzip   
-> v: Verbose     
-> f: Allows you to specify the filename of the archive
ARCHIVE_NAME: abiola_archive.tar.gz
FILES: Abiola_Images/ abiola

Decompress with tar command

  1. Open Terminal
  2. Run below command

tar -xvf abiola_archive.tar.gz

3. Here is the output.

SYNTAX:
tar OPTIONS ARCHIVE_NAME 

For our example;
OPTIONS: -xvf    
-> x: Extract the entire archive            
-> v: Show the file being process tar command          
-> f: Specifies the archive file name
ARCHIVE_NAME: abiola_archive.tar.gz

Inhaltsverzeichnis