Hello there! The easiest way to unzip a file using the Terminal (Command Line) is by making use of the unzip command.
You will get an error "bash: unzip: command not found" if you do not have to unzip the binary installed on your Linux/Ubuntu/macOS.
Step 1: Installing unzip command
Based on which Operating System you are on, make use of the package manager to get unzip installed. Below is an example using apt-get for Ubuntu,
# apt-get update
....
....
# apt-get install unzip
The following NEW packages will be installed:
unzip
...
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package unzip.
(Reading database ... 4389 files and directories currently installed.)
Preparing to unpack .../unzip_6.0-26ubuntu3.1_arm64.deb ...
Unpacking unzip (6.0-26ubuntu3.1) ...
Setting up unzip (6.0-26ubuntu3.1) ...
Note: You may need sudo privileges.
Step 2: Using unzip command to unzip files
Example 1: Unzip a file in the current location# unzip mydata.zip
Archive: mydata.zip
extracting: a.txt
Example 2: Unzip a file in a directory
# # unzip -d ~/myDir mydata.zip
Archive: mydata.zip
extracting: /root/myDir/a.txt
Make use of the -d flag followed by the directory path where you want to unzip the zip file.
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!



Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!