Active1 month ago
This issue could be due to the system file is corrupt. I recommend you to perform SFC scan, System File Checker is a utility in Windows that allows users to scan for corruptions in Windows system files and restore corrupted files.
Just downloaded a .zip file from the internet. I want to use the terminal to unzip the file. What is the correct way to do this?
ubuntu-nerd- 2) Type “unzip” and a space, then drag/drop the zip file into the Terminal window. 3) Press Enter and the zip file will be unzipped, storing all files on your computer. Your unzipped files will go to your user account folder which you can easily access using Finder.
- The files are now compressed in a.zip extension and the archive is created in the same location as the original file name, except with the.zip appended to its name. On some Apple computers, you can also compress a file by simply choosing File→Compress.
- To open a ZIP file your Mac, click the 'Finder' app on the Dock and browse to the location where the ZIP file is saved. Double-click the ZIP file to extract its contents. The contents of the ZIP file are automatically extracted to a new folder with the same name and in the same location as the ZIP file.
- This tag information is known as the “version made by” and as the name suggest, it would tag information about the program version of.zip and the files system in use.
- The files are now compressed in a.zip extension and the archive is created in the same location as the original file name, except with the.zip appended to its name. On some Apple computers, you can also compress a file by simply choosing File→Compress.
7,05444 gold badges1212 silver badges99 bronze badges
9 Answers
If the
unzip
command isn't already installed on your system, then run:After installing the unzip utility, if you want to extract to a particular destination folder, you can use:
If the source and destination directories are the same, you can simply do:
KelleyKelley21.9k22 gold badges1717 silver badges2727 bronze badges
Fabby29.2k1818 gold badges7070 silver badges173173 bronze badges
PantherPanther83k1414 gold badges164164 silver badges264264 bronze badges
A more useful tool is
7z
, which zips and unzips a range of compression formats, notably lzma
, usually the protocol offering the highest compression rates.This command installs
7z
:Program That Expands Zip Files Not Made For Mac
This command lists the contents of the zip:
This command extracts the contents of the zip:
ChrisChris1,14111 gold badge77 silver badges22 bronze badges
You can use:
to extract to
yourpath/somedir
If you want to extract to an absolute path, use
cristobalhdezcristobalhdez
Using scripting tools: Perl and Python
Many answers here mention tools that require installation, but nobody has mentioned that two of Ubuntu's scripting languages, Perl and Python, already come with all the necessary modules that allow you to unzip a zip archive, which means you don't need to install anything else. Just use either of the two scripts presented below to do the job. They're fairly short and can even be condensed to a one-liner command if we wanted to.
Python
Usage:
or
Perl
Usage:
or
See also
- script for extracting tar.gz archives.
Sergiy Kolodyazhnyy
79k1111 gold badges170170 silver badges351351 bronze badges
If the source and destination directories are the same, you can simply do:
Nadeem KhanNadeem Khan
I prefer
bsdtar
to unzip
/zip
. For extracting, they are pretty similar:However for zipping,
bsdtar
wins. Say you have this input:and want this in the zip file:
This is easy with
bsdtar
:zip does not have the
fosslinux-d
option like unzip, so you have no way to achieve the above unless you cd
first.2,47822 gold badges2121 silver badges3838 bronze badges
Steven PennySteven Penny
Here is the detailed description of options that I find useful:
karel67.6k1414 gold badges150150 silver badges170170 bronze badges
kashminderkashminder
http://www.codebind.com/linux-tutorials/unzip-zip-file-using-terminal-linux-ubuntu-linux-mint-debian/:
Install unzip So First of all we need to install unzip on our system if it’s not installed. unzip command is used to extract files from a ZIP archive.
Run the following command to install
unzip
unzip
SyntexNow Follow the steps below:
OPTION 1 – If the Zip File is in the same directory/folder in which your terminal is and we want to extract it in the present working directory.
Use the following command to achieve the above described scenario
if the zip file is protected with some password, then use the following command :
Please make sure you use -P (capital P) not -p because the are different options.
OPTION 2 – If the zip file is not present in the same directory and we want to extract/unzip the file in different directory.
Use the following command to achieve the above described scenario
if we does not use option -d the file will be extracted to present working directory.
And if the zip file is password protected we can also use
-P
.tar
is an acronym for Tape Archive. tar command is used to Manipulates archives in Linux/Unix. System administrators uses tar command frequently to rip a bunch of files or directories into highly compressed archive which are called tarball
or tar
, bzip
and gzip
in Linux/Unix system.tar Syntex
Or
tar required Flags
tar optional Flags
Create tar Archive File by Compressing an Directory or a Single File
The terminal command below will create a
.tar
file called sample_dir.tar
with a directory /home/codebind/sample_dir
or sample_dir
in present working directory.Here’s what those flags (-cvf) actually mean
-c, --create
– create a new archive-x, --extract, --get
– extract files from an archive-f, --file ARCHIVE
– use archive file or device ARCHIVECreate
tar.gz
or tgz
Archive File by Compressing an Directory or a Single FileThe terminal command below will create a
.tar.gz
file called sample_dir.tar.gz
with a directory /home/codebind/sample_dir
or sample_dir
in present working directory.Notice that we have added extra flag -z to the command.Here’s what the flag -z actually mean
-z, --gzip, --gunzip --ungzip
– Compress the archive with gzipThe command bellow will create a .tgz file. One this to notice is tar.gz and tgz both are similar.
Compressing Multiple Directories or Files at Once
Let’s say, For example we want to compress the
sample_dir
directory, the java_test
directory, and the abc.py
file to a tar file called sample_dir.tar.gz
.Run the following command to achieve the goal above.
Create
.bzip2
Archive File by Compressing an Directory or a Single FileNotice that we have added extra flag
-f
to the command.Here’s what the flag -f
actually mean-f, --file ARCHIVE
– use archive file or device ARCHIVEExtract
.tar
Archive FileWe can extract or untar the compressed file using the tar command. The command below will extract the contents of
sample_dir.tar
to the present directory.The following command will extract or Untar files in specified Directory i.e.
/home/codebind/dir_name
in this case.we have added extra flag
-C
to the command.Here’s what the flag -C
actually mean-C, --directory DIR
– change to directory DIR73.5k1414 gold badges150150 silver badges234234 bronze badges
M.A.K. RiponM.A.K. Ripon1,50811 gold badge1111 silver badges2828 bronze badges
protected by Eric CarvalhoSep 30 '15 at 12:07
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Would you like to answer one of these unanswered questions instead?