Hello Guys Today I am, going to show you how we can Zip and UnZip files in Ubuntu from the Command line.
Before we try Zip and UnZip we need to check whether we have installed Zip and Unzip otherwise it throws an error.
How to Install the Zip and Unzip in Ubuntu
sudo apt-get install zip unzip
With this, you can check if zip unzip is installed. If installed it shows you that already installed else it will automatically install zip and unzip.
Unzip File in Ubuntu using Command Line
Before executing the UnZip command, you need to go to the path where your zip is present. Suppose if I want to unzip a zip with the name vbloggers.zip and its path is /var/www/html/vbloggers.zip then first I reach the path using,
Now I am inside the html folder where my zip is present. Now I check if the zip exists in the html folder using,
This shows me all the files,folders, zip which are inside the html folder, Now I found my zip and I will execute the command to unzip my zip using,
zip File,Folder in Ubuntu using Command Line
Suppose if I want to zip a folder with the name vbloggers and its path is /var/www/html/vbloggers.zip then first I reach the path using,
Now I am inside the html folder where my folder is present.I will execute the command to zip my Folder using,
zip -r toZipName.zip foldername eg:To zip vbloggers zip -r vbloggers.zip vbloggers
That’s it now my folder is zipped with the name I provided, if you want to zip multiple folders or multiple files you need to put space after each folder or file.
zip -r toZipName.zip foldername1 foldername3 foldername3