😂How to add man and zip to "git bash" nén zip, tar, extract zip (ok)

https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows

Giải nén dùng bên nàyarrow-up-right

Cách nén file bằng lệnh zip xem cài đặt 7-zip bên dưới để có thể sử dụng zip

zip a wp-location-maps
Chúng ta có thể chỉ định đuôi được xuất ra ví dụ .zip mặc định là .7z

https://www.7-zip.org/download.htmlarrow-up-right

Sử dụng lệnh sau ok

Ask Questionarrow-up-rightAsked 6 years, 7 months agoModified 1 month agoarrow-up-rightViewed 128k times115

I am using git basharrow-up-right on Windows - that is git for Windows via the integrated bash. Apparently it uses the MINGW/MSYS underpinning. (Update from @VonC: It now uses msys2arrow-up-right since msysgit is obsoletearrow-up-right since Q4 2015.)

So there are already a lot of MSYS tools installed - from awk to zcat. However I miss the man command and zip to compress multiple files into a zip file (unzip exists!).

Where from can I install them? I do not want to install another copy of the MINGW system! Any way just to add some pre-compiled tools to the git bash installation?

Sharearrow-up-rightImprove this questionarrow-up-rightFollowedited Sep 10, 2021 at 20:20arrow-up-righti_want_more_edits's user avatararrow-up-righti_want_more_editsarrow-up-right13166 bronze badgesasked Aug 5, 2016 at 6:51halloleo's user avatararrow-up-righthalloleoarrow-up-right8,6821313 gold badges5858 silver badges107107 bronze badgesAdd a commentarrow-up-right

21 Answers

Sorted by: Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 80

Here's another, slightly different, set of instructions to install zip for git bash on windows:

  1. Download zip-3.0-bin.zip

  2. In the zipped file, in the bin folder, find the file zip.exe.

  3. Extract the file zip.exe to your mingw64 bin folder (for me: C:\Program Files\Git\mingw64\bin)

  4. Download bzip2-1.0.5-bin.zip

  5. In the zipped file, in the bin folder, find the file bzip2.dll

  6. Extract bzip2.dll to your mingw64\bin folder (same folder as above: C:\Program Files\Git\mingw64\bin)

Sharearrow-up-rightImprove this answerarrow-up-rightFollowedited Jan 7, 2022 at 18:51arrow-up-rightMickverm's user avatararrow-up-rightMickvermarrow-up-right8677 bronze badgesanswered Apr 18, 2019 at 15:49NSjonas's user avatararrow-up-rightNSjonasarrow-up-right10.2k88 gold badges6060 silver badges9292 bronze badges

Add a commentarrow-up-right55

7-zip can be added to gitbash as follows:

  1. Install 7-zip on windows.

  2. add 7-zip folder (C:\Program Files\7-Zip) to PATH On gitbash exp: export PATH=$PATH:"C:\Program Files\7-Zip" (temporary) On Windows, adding PATH like image below (permanent)

enhanced picture with better blackeningarrow-up-right

  1. duplicate a copy of 7z.exe to be zip.exe

  2. reopen gitbash again. done!

This way, it works on my laptop.

If you skip step 3. you still can call zip command as 7z instead of zip

Conclusion: Gitbash is running base on windows Path, I think you can run any command that you have added to your Windows PATH.

Sharearrow-up-rightImprove this answerarrow-up-rightFollowedited Sep 9, 2021 at 15:41arrow-up-righti_want_more_edits's user avatararrow-up-righti_want_more_editsarrow-up-right13166 bronze badgesanswered Jan 22, 2019 at 4:39nokieng's user avatararrow-up-rightnokiengarrow-up-right1,7421919 silver badges2323 bronze badges

Add a commentarrow-up-right45

2016: The zip command can be installed from GoW (Gnu On Windows)arrow-up-right. man is not provided (too big).

It is to note, however, that if you only want to add the zip command from GoW, still the whole GoW system has to be downloaded and installed. Then you can delete the other commands from the bin directory, however make sure to keep the needed dlls in the directory.

Update 2021: tar/zip are by default installed on Windows 10. 7-zip based solutions are available below.

Sharearrow-up-rightImprove this answerarrow-up-rightFollowedited Jul 15, 2021 at 13:42arrow-up-rightanswered Aug 5, 2016 at 7:39VonC's user avatararrow-up-rightVonCarrow-up-right1.2m508508 gold badges42704270 silver badges50955095 bronze badges

Show 2 more commentsarrow-up-right18

git-archivearrow-up-right, is prepared without any installation, can create zip-archive.

Following script may be usable: zip.sh foo.zip target_file_or_dir

Sharearrow-up-rightImprove this answerarrow-up-rightFollowedited Sep 2, 2021 at 12:16arrow-up-rightsakra's user avatararrow-up-rightsakraarrow-up-right60.5k1515 gold badges167167 silver badges148148 bronze badgesanswered Jul 13, 2018 at 0:59DEWA Kazuyuki - 出羽和之's user avatararrow-up-rightDEWA Kazuyuki - 出羽和之arrow-up-right2,3051414 silver badges5454 bronze badges

Add a commentarrow-up-right14

I am so glad to share my experience on this issue that I haven't known for two years since the first day I played with Groovy. My method needs to have git for Windows installed in Windows OS.

These steps are for installing 7z command-line utility, which behaves a bit differently from zip:

  • Download and install 7-Zip from its official websitearrow-up-right. By default, it is installed under the directory /c/Program Files/7-Zip in Windows 10 as my case.

  • Run git Bash under Administrator privilege and navigate to the directory /c/Program Files/Git/mingw64/bin, you can run the command ln -s "/c/Program Files/7-Zip/7z.exe" 7z.exe

I am pretty sure it could help you a lot. Trust me!

Sharearrow-up-rightImprove this answerarrow-up-rightFollowedited Jul 29, 2019 at 15:52arrow-up-rightErik Humphrey's user avatararrow-up-rightErik Humphreyarrow-up-right34355 silver badges1818 bronze badgesanswered Mar 14, 2018 at 18:32Tung's user avatararrow-up-rightTungarrow-up-right1,52944 gold badges1515 silver badges3232 bronze badges

Add a commentarrow-up-right12

On Windows, you can use tar instead of zip.

which is same as,

no need to install any external zip tool.

Sharearrow-up-rightImprove this answerarrow-up-rightFollowanswered Feb 7, 2022 at 18:13Vikram Sapate's user avatararrow-up-rightVikram Sapatearrow-up-right87199 silver badges1414 bronze badges

Add a commentarrow-up-right8

I use chocoarrow-up-right as my Windows Package Manager.

I install 7zip with choco using PowerShell (you must be admin to use Choco)

Open another gitbash Terminal and locate the 7z.exe executable

Do a straight copy of 7z.exe to zip.exe and voila

Sharearrow-up-rightImprove this answerarrow-up-rightFollowanswered May 2, 2020 at 22:31setrar's user avatararrow-up-rightsetrararrow-up-right10322 silver badges55 bronze badges

Add a commentarrow-up-right6

You can mimic a small subset of man behavior in the shell by mapping man <command> to <command> --help | less

Unfortunately, on my machine bash aliases won't add flags to positional arguments, it will try to run the flag as a command and fail (alias man="$1 --help" doesn't work).

And a function called man() is not allowed!

Luckily a combination of bash functions and aliases can achieve this mapping. Put the code below in your ~/.bashrc (create one if it is not there). Don't forget to source ~/.bashrc.

It doesn't get you the full man page, but if all you're looking for is basic info on a command and its flags, this might be all you need.

Sharearrow-up-rightImprove this answerarrow-up-rightFollowedited Aug 9, 2017 at 20:56arrow-up-rightanswered Aug 9, 2017 at 17:51Dylan Kirkby's user avatararrow-up-rightDylan Kirkbyarrow-up-right1,4271111 silver badges1919 bronze badges

Add a commentarrow-up-right5

You can install individual GNU tools from http://gnuwin32.sourceforge.net/packages.htmlarrow-up-right such as zip.

Then add "/c/Program Files (x86)/GnuWin32/bin" to PATH in your startup script like .profile, .bash_profile, .bashrc, etc.

Sharearrow-up-rightImprove this answerarrow-up-rightFollowanswered Mar 19, 2018 at 4:49wisbucky's user avatararrow-up-rightwisbuckyarrow-up-right31.2k1010 gold badges140140 silver badges9898 bronze badgesAdd a commentarrow-up-right4

Here are the steps you can follow.

  1. Find out whatever command you are missing Here I need zip and bzip2 for zip command. Because zip command relies on bzip2.dll to run. Otherwise you will get error “error while loading shared libraries: ?: cannot open shared object file: No such file or directory”.

  2. Unzip the downloaded files Here I am downloading “zip-3.0-bin.zip” for “zip.exe” and “bzip2-1.0.5-bin.zip” for “bzip2.dll” in the bin folder. /bin/.exe

  3. Copy the command exe file into git-bash folder Here I am copying “zip.exe” and “bzip2.dll” to \Git\usr\bin.

Reference Link https://ranxing.wordpress.com/2016/12/13/add-zip-into-git-bash-on-windows/arrow-up-right

Sharearrow-up-rightImprove this answerarrow-up-rightFollowanswered Apr 18, 2018 at 18:37sagecoder's user avatararrow-up-rightsagecoderarrow-up-right10155 bronze badgesAdd a commentarrow-up-right3

ln -s /mingw64/bin/ziptool.exe /usr/bin/zip

Sharearrow-up-rightImprove this answerarrow-up-rightFollowanswered Feb 3, 2021 at 14:19Zartc's user avatararrow-up-rightZartcarrow-up-right14466 bronze badges

Add a commentarrow-up-right3

steps to install SDKMAN on windows

Run Windows Terminal in Admin rights. open git bash inside. (Ctrl + Shift + 4)

enter image description herearrow-up-right

After you can install Java like this.

Done ! :)

Sharearrow-up-rightImprove this answerarrow-up-rightFollowedited Apr 8, 2022 at 7:01arrow-up-rightanswered Feb 8, 2022 at 14:26STEEL's user avatararrow-up-rightSTEELarrow-up-right8,34099 gold badges6767 silver badges8787 bronze badgesAdd a commentarrow-up-right2

In msys2, I restored the functionality of git help <command> by installing man-db:

For zip functionality, I also use git archive (similar to yukihane's answer).

Sharearrow-up-rightImprove this answerarrow-up-rightFollowanswered Oct 31, 2019 at 18:06Sheldon Campbell's user avatararrow-up-rightSheldon Campbellarrow-up-right2122 bronze badgesAdd a commentarrow-up-right2

Here's yet another 7-Zip option that I didn't notice:

Create a script named zip:

Reference 7z specifying the add command followed by the args:

Finally make it executable


This helped to make a ytt build script happy.

Sharearrow-up-rightImprove this answerarrow-up-rightFollowanswered Sep 20, 2020 at 5:30bvj's user avatararrow-up-rightbvjarrow-up-right3,2443131 silver badges2929 bronze badgesAdd a commentarrow-up-right2

Though this question as been answered quite thoroughly in regards to man there is one alternative to zipping that has not been highlighted here yet. @Zartc brought to my attention that there is a zip compression utility built-in: ziptool. In trying to use it however I found out it is no where near a drop-in replacement and you need to specify each individual file and folder. So I dug into the docs and experimented until I had a bash-function that can do all the heavy lifting and can be used very similar to a basic zip -qrf name * compression call:

You can then for example zip the contents of the current directory by calling it like this:

Sharearrow-up-rightImprove this answerarrow-up-rightFollowanswered Feb 15, 2021 at 16:23Leon S.'s user avatararrow-up-rightLeon S.arrow-up-right3,27711 gold badge1818 silver badges1515 bronze badges

Add a commentarrow-up-right1

If you are willing to install CygWin also, you can add the CygWin path to your GitBash path, and if zip is there, it will work. e.g. add

to your .bashrc; NOTE: I would put it at the end of the path as shown, not the beginning.

Since CygWin has a UI-based installer, it's easy to add or remove applications like zip or man.

You can figure out the windows paths of each by saying

in each respective shell.

Sharearrow-up-rightImprove this answerarrow-up-rightFollowanswered Mar 1, 2019 at 19:11miles zarathustra's user avatararrow-up-rightmiles zarathustraarrow-up-right19122 silver badges55 bronze badges

Add a commentarrow-up-right0

Regarding zip, you can use a following perl script to pack files:

If you make it executable, name it zip, and put it in your $PATH, you can run it like this:

zip archive.zip files...

however it will not work for directories. There is no need to install anything, as perl and all required modules are already there in the Git for Windows installation.

Regarding man, at least for git there is a documentation invoked like this:

git option --help

it will open in your default browser.

Sharearrow-up-rightImprove this answerarrow-up-rightFollowedited Feb 14, 2019 at 14:39arrow-up-rightanswered Jan 30, 2019 at 18:15mik's user avatararrow-up-rightmikarrow-up-right3,43533 gold badges2121 silver badges2929 bronze badgesAdd a commentarrow-up-right0

Here is my experience, I cant run and exe or .msi files in my laptop. so downloaded filed from https://github.com/bmatzelle/gow/wikiarrow-up-right > go to download Now and Downloaded Source Code (Zip) and unzipped this file in a folder and updated path variable with folder name. This worked out for me.

Sharearrow-up-rightImprove this answerarrow-up-rightFollowanswered Feb 2, 2021 at 6:44Ravi G's user avatararrow-up-rightRavi Garrow-up-right2122 bronze badgesAdd a commentarrow-up-right0

If you want to zip files without needing to install any additional tools on Windows, in a way that works both on git bash and on other *nix systems, you might be able to use perl.

Per Josip Medved's blogarrow-up-right, the following script creates an .epub (which is a zip file), and includes a filter for stripping src/ from the files added to the zip:

Sharearrow-up-rightImprove this answerarrow-up-rightFollowanswered Jul 11, 2022 at 19:58Marc Durdin's user avatararrow-up-rightMarc Durdinarrow-up-right1,65522 gold badges2020 silver badges2727 bronze badges

  • Interesting to know, but IMHO a how-to about "using language xy to create zip files" is not really an answer to how to install zip and man commands on Windows, particularly when there are quite a few other 'closer' answers... – halloleoarrow-up-right Jul 12, 2022 at 1:24arrow-up-right

Add a commentarrow-up-right0

  1. copy zip.exe and bzip2.dll from C:\Program Files (x86)\GnuWin32\bin to C:\Program Files\Git\mingw64\bin

  2. reopen git-bash

Sharearrow-up-rightImprove this answerarrow-up-rightFollowanswered Jan 27 at 6:26jiaqi zhu's user avatararrow-up-rightjiaqi zhuarrow-up-right1Add a commentarrow-up-right-3

Solutions for me were just to install zip on my terminal(bash):

Sharearrow-up-rightImprove this answerarrow-up-rightFollowedited Jun 24, 2022 at 22:27arrow-up-rightanswered Jun 24, 2022 at 22:14eldinT's user avatararrow-up-righteldinTarrow-up-right52611 gold badge55 silver badges1010 bronze badges

  • 1The question is about Git bash on Windows. There is no apt package manager in this environment. – Christianarrow-up-right

Last updated