简体   繁体   中英

How to unzip a file using git bash (Windows)?

Is there a piece of code to unzip a file using git bash on windows? I tried unzipping with this line of code:

unzip somefile.zip

and it returns a

bash: unzip: command not found

Install the latest git (git-bash) from https://git-scm.com/downloads - at the time of writing it is the 2.10.0 version. It comes with unzip packaged inside as one of the tools. Check optional unix tools during setup if you already use gitbash as your go-to console.

sudo apt-get install unzip

unzip your_zip_file.zip

在 bash 提示符下在 Windows 10 Pro 中为我工作。

tar -zxvf <filename>

where
z means (un)z̲ip,
x means ex̲tract files from the archive,
v means print the filenames v̲erbosely, and
f means the following argument is a f̱ilename.

The git bash already has unzip.

GE00241@0430L MINGW32 /i/UserDatastores/Private/common_words$ unzip archive.zip
Archive:  archive.zip
replace train/train/0.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: n
replace train/train/1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
inflating: train/train/1.txt
inflating: train/train/10.txt
inflating: train/train/100.txt
inflating: train/train/1000.txt
inflating: train/train/10000.txt
inflating: train/train/100001.txt
inflating: train/train/100002.txt 
git --version
git version 2.14.2.windows.1 

It could be that you have an older version of Git. However, I am not sure if that's the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM