How to Zip and Unzip file & folders in Termux 🤐📁
Ashutosh Raghav January 20, 2023
Hey Guys, It's me Ashutosh Raghav 🙋🏻♂️, Termux is a terminal emulator that has the ability to do a lot of advance level things but, these things can only be done when you know basic things like, installing packages and downloading files inside the termux using command line and knowing how to zip and unzip the files. since compression is one of the most common things that we see on the internet while working on any kind of project I think we all should know how to zip or unzip any files. This is just a termux-basics post but it is as important as using advance level termux tools so make sure you learn it well and become a successful ethical hacker or at least a good Termux user. 🖥💻
What is the need for Zip and Unzip in Termux?
While working with files inside termux or on any other computer, we use zip to keep multiple files in a digital bag. Let's say you have created a website in your termux and it has 10 files and a folder, and you wanna share it to the world by internet, how are you going to do it? we can't share files one by one so we use zip as a zipped bag to carry everything inside just one zip file and if anyone downloads it, they can again unzip it and they will get all the files safely without any file corruption. So one of the main reasons to use zip files is to keep the data in an organized manner.
The other main reason to use zip files is that, it allows us to do compression and encryption, so let's say you want to send a 1GB file to your friend, One way is to just send him the file and it will take a lot of time to upload and download or you can just use compression on your file by making it a compressed zip file and the size will be reduced around 50% so when the file will be in compressed form the size will be around 500MB. If you want to lock multiple files so that only specific people can access them then you can lock the zip file and tell them the password, these password-protected zip files can only be accessed by users with actual passwords. I think these are enough reasons to learn these simple commands so let's begin.
How to Zip and Unzip files & folders in Termux?
Install zip package in Termux:
First of all, you need to install one simple package inside your termux name zip, just copy and paste the below command and it will be installed in a few seconds.
Use Zip in Termux:
There are multiple different arguments while zipping the files so you should read the below commands carefully and learn the use of all those arguments.
1) Zip any file or folder in termux:
To zip files or folders the most simple way is to just use the zip command followed by the name of the file that you want to be after it is compressed like games.zip then type the name of the file.
zip games.zip file1.txt
2) Unzip any zipfile in termux:
To Unzip files in termux you just have to be in the same folder as the zip file and type unzip followed by the zipfile name.zip.
unzip games.zip
3) Zip multiple files and folders inside one zip file :
To zip files and folders together you cannot use the first simple command, you have to add -r argument. after adding -r you can add any file and folders and it will be zipped together. keep in mind that you can add as many files and folders as you want here I am adding only 2.
zip -r mydata.zip file1.txt folder1/
To unzip this type of zip file you have to use simple unzip command.
4) Make a password-protected Zip file in termux :
To make a zip file that has password protection you have to use -e argument while using the zip command. This requires one more step and that is entering the password, just use the below example as a reference to learn it. As you can see the command is simple, just enter the command and press enter and you will see the prompt where you have to enter the password, type the password that you wanna keep, and keep in mind that you won't be able to see anything getting typed on the screen but type the password and press enter and you have to type that password again and the zip file will be created in few seconds.
zip -e mydata.zip file1.txt
5) Unzip password-protected Zip files in termux :
To unzip a password-protected zip file you just have to use the simple unzip command but when you press enter, you have to enter the password that you used while creating the zip file. again, you won't be able to see what you are typing because of security reasons but type your password and press enter and the file will be unzipped.
unzip mydata.zip
6) Make a Compressed zip file in termux :
This is going to be your favorite argument because this is going to be the most useful one if you have any file that you want to compress as a zip file just use the -9 argument, this will take some time to compress the files but its gonna reduce the file size a lot.
zip -9 game.zip GTA5.apk
To unzip this file you just have to use a simple unzip command.
7) Extra Tips:
You can always combine multiple arguments to get the desired output like using -9e argument to create a password-protected compressed zip file. also, you can always type zip -h to see more arguments like -m which will delete all the files that you are adding in the zip file from the main source (-m is for move).
Conclusion :
Since zipping is so common thing while using Linux I thought I need to write a detailed post on it so that people can know multiple options and use it. If you know the termux basic command then you can move inside your phone's storage and compress any file that you want to send to someone to save time and mobile data. I have told you guys about the most useful arguments and if you can remember them then that's gonna be more than enough for your everyday use. if you like this termux basics tool guide then you should check out more to get better at termux. If you didn't understand any part or anything was confusing then please comment down below. Thanks for reading guys and as always, Stay Ethical 👾.
- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
Comments
Post a Comment