If you have a .zip file on your Ubuntu system and you are wondering how to unzip the file using the Terminal (Command Line), well you can make use of the unzip binary.
First thing we need to check if unzip is installed on your Ubuntu system by just typing unzip on on the Terminal Prompt.
# unzip
bash: unzip command not found.
If you get the command not found, well you need to get it installed (this will be the case if you are using a docker image of Ubuntu).
To download and install unzip we will need to make use of the apt-get package manager.
sudo apt-get install unzip
Installation logs:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
zip
The following NEW packages will be installed:
unzip
0 upgraded, 1 newly installed, 0 to remove, and 0 not upgraded.
Need to get 171 kB of archives.
After this operation, 360 kB of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 unzip arm64 6.0-26ubuntu3.1 [171 kB]
Fetched 171 kB in 1s (179 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package unzip.
(Reading database ... 4457 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) ...
Now we are good to unzip our zip file.
unzip my_zip_file.zip
Note this will extract the contents of the zip file in the current directory.
If you wish to unzip the contents to a specific location then you can make use of the -d parameter.
Example:unzip my_zip_file.zip -d path/to/the/destination/directory
The best way to know more about the utility is by using the unzip -hh option
root@adf079f415ef:/# unzip -hh
Extended Help for UnZip
See the UnZip Manual for more detailed help
UnZip lists and extracts files in zip archives. The default action is to
extract zipfile entries to the current directory, creating directories as
needed. With appropriate options, UnZip lists the contents of archives
instead.
Basic unzip command line:
unzip [-Z] options archive[.zip] [file ...] [-x xfile ...] [-d exdir]
Some examples:
unzip -l foo.zip - list files in short format in archive foo.zip
unzip -t foo - test the files in archive foo
unzip -Z foo - list files using more detailed zipinfo format
unzip foo - unzip the contents of foo in current dir
unzip -a foo - unzip foo and convert text files to local OS
....
Flag | Description |
---|---|
-Z | Switch to zipinfo mode. Must be the first option. |
-hh | Display extended help. |
-A | Print extended help for DLL (OS/2, Unix DLL). |
-c | Extract files to stdout/screen. Includes names. EBCDIC conversions are done if needed. |
-f | Freshen by extracting only if the file on disk is older. |
-l | List files using short form. |
-p | Extract files to pipe (stdout). Only file data is output in binary mode. |
-t | Test archive files. |
-T | Set timestamp on archive(s) to that of the newest file. |
-u | Update existing older files on disk as well as extract new files. |
-v | Use verbose list format. Can also be used to show version information. |
-z | Display only the archive comment. |
-a | Convert text files to the local OS format. Handles line ends, EOF marker, and EBCDIC character set conversions. |
-b | Treat all files as binary. |
-C | Use case-insensitive matching. |
-D | Skip restoration of timestamps for extracted directories. |
-j | Junk paths and deposit all files in the extraction directory. |
-L | Convert uppercase-only names to lowercase. |
-n | Never overwrite existing files. Skip extracting that file without prompt. |
-o | Overwrite existing files without prompting. |
-q | Perform operations quietly. The more q (as in -qq), the quieter. |
-s | Convert spaces in filenames to underscores. |
-U | Show non-local characters as ASCII text escapes. |
-V | Retain VMS file version numbers. |
-W | Modify pattern matching to allow matching at specific directory levels. |
-X | Restore UICs and ACL entries under VMS, or UIDs/GIDs under Unix, or ACLs under certain operating systems. |
-Y | Treat archived name endings of .nnn as VMS version numbers. |
-$ | Restore volume label if the extraction medium is removable. |
-/ e | Use e as the extension list. |
-^ | Allow control characters in names of extracted entries. |
-2 | Force unconditional conversion of names to ODS-compatible names (VMS). |
Facing issues? Have Questions? Post them here! I am happy to answer!
- Fix - sudo: systemctl: command not found
- How to know the version of Ubuntu
- [Fix] Ubuntu E: Unable to locate package sudo error
- How to install Apache Maven on Ubuntu
- Steps to Kill a Running Process in Ubuntu Linux
- How to know current Ubuntu Linux version via terminal command
- How to stop/start/restart apache server using command [Ubuntu]
- Fix: Ubuntu (Linux) - bash: sudo: command not found error
- Ubuntu: How to search for a package to install using apt in Terminal
- Fix: E: Command line option --installed is not understood in combination with the other options
- How to install Python on Ubuntu
- Ubuntu Linux: How to Login as root User
- Access Windows share folder in Ubuntu Device in Network
- Add a User as a Sudoer Using Ubuntu Linux Command Line Terminal
- Install Oh My Zsh on Ubuntu Docker complete steps
- Fix: Make makefile:31 Error 127 (GCC)
- [fix] openssl No such file or directory error C++
- How to install zsh shell on Ubuntu
- Install Golang (Go) on Ubuntu
- Ubuntu Linux: Unzip a zip file using Terminal
- Where are Environment Variables stored in Ubuntu
- apt-get list --installed packages in Ubuntu Linux
- Ubuntu: List all Installed Packages using apt
- Quick steps to install Nginx on Ubuntu Linux
- How to kill service running on a port on Ubuntu Linux
- How to Select All text in vim/vi editor using Keyboard - Linux
- Resolve - zsh: command not found: code - zsh
- How to take Screenshot on Android device - Android
- No connection available Use Connect-SPOService before running this CmdLet - SharePoint
- Spell check not working in Gmail : Mac OS X - Mac-OS-X
- How to go to next line in Excel on Mac (Keyboard Shortcut) - Shortcuts
- Python print() function without a newline using the end parameter - Python
- How to open SharePoint Online Modern SPFX links in new tab - SharePoint