Unzip files in Linux
126
Unlike tar and gzip, zip isn't included by default in Linux distributions (usually). Also creating zip arhives and extracting from them are made by different tools which should be installed independently.
So first thing you need is to install unzip
tool.
CentOS, Red Hat, Fedora
yum install unzip
Debian, Ubuntu
apt install unzip
Now you can extract zip archive with a simple command:
unzip archive.zip
To extract a specific file use the following:
unzip archive.zip journal.txt
To extract a folder use:
unzip archive.zip blog
You can extract everything but some specific files. To exclude files or folders use -x
switch with a list of names to exclude:
unzip archive.zip -x blog journal.txt
To extract zip archive into different directory use -d
switch:
unzip archive.zip -d /home/sam/blog
Rate this post:
Share this page:
See also how to:
How to extract files from different tar archives in Linux command line
How to pretty print XML documents on Linux
How to run your PHP or Bash script as root in the most secure way
How to create TAR archive in PHP, compress it as Gzip or Bzip2, or extract files from it
How to install PHP FastCGI Process Manager (FPM) on CentOS 7