
Create a test folder containing the test files.
Lzip rhel archive#
To extract this archive we will use the unzip command.ġ.
Lzip rhel zip#
We will create a ZIP archive called test_archive.zip which contains a directory test_directory which in turn contains 3 empty test files, test1.txt, test2.h, test3.c. $ zip -r -q -9 archive_compressed test_directory Check the details of the new archive and the previous archive using ls -l, you should see that the size of the new archive is smaller than the previous archive as the data compression has been increased. Create another archive with the same contents but increase the compression level to 9. Zip -r -q archive_default_compression test_directoryģ. Return to the parent directory and create a new ZIP archive with the default compression level of 6. They have zero bytes of data but we can add random “garbage data” to the files using a quick terminal command that will dump 64MB into each file. Right now our test files test1.txt, test2.h and test3.c are empty. We can simply add a numerical argument to change the level of compression.ġ. zip -r -q new_archive2 test_directoryĬhange the Level of Data Compression for a ZIP Archiveīy default, the zip command uses a compression value of 6 taken from a range of 0-9 with 0 being uncompressed and 9 being the maximum allowable level of compression. Then use ls to check the new archive has been created. You should see that this time that no steps are reported to the terminal in the creation of this archive. Make another similar ZIP archive using the -q (quiet) argument to disable the verbose output. Notice when you create the archive using the -r argument that you see a verbose output detailing each stage of the command as it descends into the directory and archives the files and folder. Create a ZIP archive containing the test_directory directory and its contents.

We can’t be inside the directory that we wish to add to the archive. Go up one directory and check that you are not inside the directory to archive. To avoid confusion it would be good practice to delete the archives leaving only the original files that we created. Delete the archives inside the test_directory but keep the other files.

Often we need to make a ZIP archive containing directories which contain files, we can do this by adding the recursive argument -r to the zip command.ġ.
