4/18/2023 0 Comments Convert video files with peazipBeing able to select specific file types and being able to set the compression level in the terminal emulator gives quick access to these powerful tools that are often hard to find in a GUI application.Why use a top-notch file archiver? After all, we have huge hard drive storage capabilities and mobile access to numerous free cloud storage services.ĭepending on the volume of files you generate or process, you still get an advantage to using file compression. With these few basic uses of the zip command you now have lots of options when creating ZIP archives in the linux terminal. Change directory and list the contents to verify the files have been extracted correctly. We could also pass an absolute path which provides the full path to the target location.After extracting the archive, move into the specified directory and use ls to check the archive has been extracted. In this example we extract the contents to the Music directory using a relative path. We can specify a relative or absolute location. Extract the test_archive.zip to a specified directory. We can add the -d argument to the unzip command to achieve this.ġ. ![]() Often we will want to extract an archive into a different specified location. unzip test_archive.zipĮxtracting a ZIP Archive to a Specified Location Using unzip with no extra arguments we see a verbose output report of each step of extracting the archive. If we extract the test_archive.zip in the parent directory which contains the test_directory we would be asked if we want to replace or rename the archive. ![]() The zip command has two arguments, the name of the archive that we wish to create, and the source of the files to be put into the archive. Check that the archive has been successfully created using ls. Create a ZIP archive called test_archive.zip that contains the test_directory. After creating the test directory and files check the files have been created using ls before returning to the parent directory. Create a test folder containing the test files. To extract this archive we will use the unzip command.ġ. 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.ġ.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |