Last updated on July 2nd, 2018 at 01:39 pm
When we create a backup of the files we always create a zip file to download all file in the single download. If your site has cpanel then it was very easy to create zip but if you’re at VPS then most of the work is done on the terminal. Now in this post, I will explain to you how to create or extract tar.gz and zip file in terminal follow below simple steps.
Create Zip file from the terminal
- Install Zip if not installed using this command sudo apt-get install zip
- Now run this command zip -r my.zip location_of_directory to create a zip file.
Extract Zip file using terminal
- Run this command to extract zip file unzip my.zip
Create tar.gz file from the terminal
- To create tar.gz file of folder run this command tar -zcvf my-tar-archive.tar.gz source-folder-name .
Extract tar.gz file using terminal
- To extract the file you can run this command on the terminal tar -zxvf tar-archive-name.tar.gz
Hope this post is helpful.