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

Giải nén dùng bên [này](https://cauhinhserver-ubuntu.gitbook.io/learnubuntu/cac-lenh-co-ban-danh-cho-vps-va-may-chu-linux)

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<br>

<figure><img src="/files/6nGAtVL7TEamSzVH7UKu" alt=""><figcaption><p><em><strong>zip a wp-location-maps</strong></em></p></figcaption></figure>

<figure><img src="/files/nyuPlmBTqbgzkOYkIrx3" alt=""><figcaption><p><em><strong>Chúng ta có thể chỉ định đuôi được xuất ra ví dụ .zip mặc định là .7z</strong></em></p></figcaption></figure>

<figure><img src="/files/jBjdIjnmcCT7eLDCL95X" alt=""><figcaption></figcaption></figure>

```
unzip file.zip: giải nén file .zip
```

<https://www.7-zip.org/download.html>

<figure><img src="/files/sTdGx2c3IEuF5911Smij" alt=""><figcaption></figcaption></figure>

Sử dụng lệnh sau ok&#x20;

```
tar -a -c -f output.zip bitnami.css
```

<figure><img src="/files/wXRNCnQYClQTmAfPg2bL" alt=""><figcaption></figcaption></figure>

## [How to add man and zip to "git bash" installation on Windows](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows)

[Ask Question](https://stackoverflow.com/questions/ask)Asked 6 years, 7 months agoModified [1 month ago](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows?lastactivity)Viewed 128k times115

I am using [`git bash`](https://git-for-windows.github.io/) on Windows - that is `git` for Windows via the integrated `bash`. Apparently it uses the `MINGW`/`MSYS` underpinning. (*Update from @VonC: It now* [*uses msys2*](https://stackoverflow.com/a/35099458/6309) *since* [*msysgit is obsolete*](https://stackoverflow.com/a/26826359/6309) *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?

* [windows](https://stackoverflow.com/questions/tagged/windows)
* [git](https://stackoverflow.com/questions/tagged/git)
* [installation](https://stackoverflow.com/questions/tagged/installation)
* [git-bash](https://stackoverflow.com/questions/tagged/git-bash)
* [mingw-w64](https://stackoverflow.com/questions/tagged/mingw-w64)

[Share](https://stackoverflow.com/q/38782928)[Improve this question](https://stackoverflow.com/posts/38782928/edit)Follow[edited Sep 10, 2021 at 20:20](https://stackoverflow.com/posts/38782928/revisions)[![i\_want\_more\_edits's user avatar](https://www.gravatar.com/avatar/7b2f0c456464c9b9f01dd721f5d8a666?s=64\&d=identicon\&r=PG\&f=1)](https://stackoverflow.com/users/13914780/i-want-more-edits)[i\_want\_more\_edits](https://stackoverflow.com/users/13914780/i-want-more-edits)13166 bronze badgesasked Aug 5, 2016 at 6:51[![halloleo's user avatar](https://www.gravatar.com/avatar/85e0b1fb0e5f202323635b057b1a91b4?s=64\&d=identicon\&r=PG)](https://stackoverflow.com/users/65889/halloleo)[halloleo](https://stackoverflow.com/users/65889/halloleo)8,6821313 gold badges5858 silver badges107107 bronze badges[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)

### 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. [Navigate to this sourceforge page](https://sourceforge.net/projects/gnuwin32/files/zip/3.0/)
2. Download `zip-3.0-bin.zip`
3. In the zipped file, in the `bin` folder, find the file `zip.exe`.
4. Extract the file `zip.exe` to your `mingw64` bin folder (for me: `C:\Program Files\Git\mingw64\bin`)
5. [Navigate to to this sourceforge page](https://sourceforge.net/projects/gnuwin32/files/bzip2/1.0.5/)
6. Download `bzip2-1.0.5-bin.zip`
7. In the zipped file, in the `bin` folder, find the file `bzip2.dll`
8. Extract `bzip2.dll` to your `mingw64\bin` folder (same folder as above: `C:\Program Files\Git\mingw64\bin`)

[Share](https://stackoverflow.com/a/55749636)[Improve this answer](https://stackoverflow.com/posts/55749636/edit)Follow[edited Jan 7, 2022 at 18:51](https://stackoverflow.com/posts/55749636/revisions)[![Mickverm's user avatar](https://lh4.googleusercontent.com/-PAyAT-mN9jQ/AAAAAAAAAAI/AAAAAAAApLM/Gs19EmAYNTg/photo.jpg?sz=64)](https://stackoverflow.com/users/11124683/mickverm)[Mickverm](https://stackoverflow.com/users/11124683/mickverm)8677 bronze badgesanswered Apr 18, 2019 at 15:49[![NSjonas's user avatar](https://www.gravatar.com/avatar/374b8f6eb41fb881b3c726786bc8383a?s=64\&d=identicon\&r=PG)](https://stackoverflow.com/users/800619/nsjonas)[NSjonas](https://stackoverflow.com/users/800619/nsjonas)10.2k88 gold badges6060 silver badges9292 bronze badges

* 5This worked like magic - beyond me why it requires the bzip2.dll file though. – [Jeremy Ninnes](https://stackoverflow.com/users/1704885/jeremy-ninnes) [Jan 21, 2021 at 1:35](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment116374911_55749636)
* This worked! Be sure to copy `bzip2.dll` and not `bzip2.zip` like I tried which didn't work. – [duyn9uyen](https://stackoverflow.com/users/2128937/duyn9uyen) [Mar 18, 2021 at 18:21](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment117901835_55749636)
* Thanks for this quick tip. I recently filled up the system disk trying to install large packages and sysadmin went postal on me. I needed a small backdoor way to get stuff done today, and this was just the ticket. – [J B](https://stackoverflow.com/users/9983172/j-b) [Jun 2, 2021 at 14:55](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment119852719_55749636)
* 2022 this still works for a fellow Windows addict. many thanks. – [HackerMan0](https://stackoverflow.com/users/8876886/hackerman0) [Oct 9, 2022 at 15:57](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment130670119_55749636)

[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)55

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)<br>

[![enhanced picture with better blackening](https://i.stack.imgur.com/W2Pj7.png)](https://i.stack.imgur.com/W2Pj7.png)

3. duplicate a copy of `7z.exe` to be `zip.exe`
4. 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`.

[Share](https://stackoverflow.com/a/54301375)[Improve this answer](https://stackoverflow.com/posts/54301375/edit)Follow[edited Sep 9, 2021 at 15:41](https://stackoverflow.com/posts/54301375/revisions)[![i\_want\_more\_edits's user avatar](https://www.gravatar.com/avatar/7b2f0c456464c9b9f01dd721f5d8a666?s=64\&d=identicon\&r=PG\&f=1)](https://stackoverflow.com/users/13914780/i-want-more-edits)[i\_want\_more\_edits](https://stackoverflow.com/users/13914780/i-want-more-edits)13166 bronze badgesanswered Jan 22, 2019 at 4:39[![nokieng's user avatar](https://i.stack.imgur.com/v0osL.jpg?s=64\&g=1)](https://stackoverflow.com/users/3397462/nokieng)[nokieng](https://stackoverflow.com/users/3397462/nokieng)1,7421919 silver badges2323 bronze badges

* 5This worked for me, but didn't find the need for step 3, I used the `7z` command instead. Example: `7z a -r zipped_filename.zip *` – [martti d](https://stackoverflow.com/users/1122566/martti-d) [Apr 8, 2019 at 3:34](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment97831062_54301375)
* @linuxeasy I have never done that before as I remember. – [nokieng](https://stackoverflow.com/users/3397462/nokieng) [Aug 5, 2019 at 2:10](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment101190904_54301375)
* 1Thanks @nokieng. Step 3 was what I was looking for my specific need of installing Sdkman on windows. – [Dexter](https://stackoverflow.com/users/1852693/dexter) [Jun 9, 2020 at 10:09](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment110147056_54301375)&#x20;
* great.. this was a simple, easy and effective trick that not only worked just fine but saved a lot of time:) Thank you. I was in the same situation and now good to go with the sdkman installation. – [itsraghz](https://stackoverflow.com/users/1001242/itsraghz) [Aug 26, 2020 at 17:09](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment112469460_54301375)
* 1This worked for me saved me having to install zip on gitbash which for some inexplicable reason doesn't have a package manager – [SystemsInCode](https://stackoverflow.com/users/5353824/systemsincode) [Dec 12, 2020 at 14:36](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment115384083_54301375)

[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)45

2016: The `zip` command can be installed from [GoW (Gnu On Windows)](https://github.com/bmatzelle/gow/wiki). `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.

[Share](https://stackoverflow.com/a/38783744)[Improve this answer](https://stackoverflow.com/posts/38783744/edit)Follow[edited Jul 15, 2021 at 13:42](https://stackoverflow.com/posts/38783744/revisions)answered Aug 5, 2016 at 7:39[![VonC's user avatar](https://i.stack.imgur.com/I4fiW.jpg?s=64\&g=1)](https://stackoverflow.com/users/6309/vonc)[VonC](https://stackoverflow.com/users/6309/vonc)1.2m508508 gold badges42704270 silver badges50955095 bronze badges

* Thanks for the clarification about `msys2`. – [halloleo](https://stackoverflow.com/users/65889/halloleo) [Aug 9, 2016 at 3:52](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment65048886_38783744)
* Not sure about installing GoW - this would replicate most of the already existng comands. So maybe it is better to start again with msys2 itself and then add `git`, `zip` and `man` to it... – [halloleo](https://stackoverflow.com/users/65889/halloleo) [Aug 9, 2016 at 3:58](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment65048965_38783744)
* You can extract from how only the zip.exe you need. – [VonC](https://stackoverflow.com/users/6309/vonc) [Aug 9, 2016 at 4:12](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment65049181_38783744)
* I have a controlled laptop and can't install things into the typical directories. I can put "zip" in my path, but what about the DLLs? – [tggagne](https://stackoverflow.com/users/214046/tggagne) [Feb 1, 2017 at 17:28](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment71149586_38783744)
* 1\@AsGoodAsItGets I agree. I have edited this (old) answer to say as much. – [VonC](https://stackoverflow.com/users/6309/vonc) [Jul 15, 2021 at 13:43](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment120875606_38783744)

[Show 2 more comments](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)18

[`git-archive`](https://git-scm.com/docs/git-archive), is prepared without any installation, can create zip-archive.

```
mkdir workrepo
cd workrepo
git init
cp -r [target_file_or_dir] .
git add .
git commit -m commit
git archive -o ../myarchive.zip @
cd ..
rm -rf workrepo
```

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

```
#!/usr/bin/bash

set -eu

unset workdir
onexit() {
  if [ -n ${workdir-} ]; then
    rm -rf "$workdir"
  fi
}
trap onexit EXIT

workdir=$(mktemp --tmpdir -d gitzip.XXXXXX)


cp -r "$2" "$workdir"

pushd "$workdir"
git init
git config --local user.email "zip@example.com"
git config --local user.name "zip"
git add .
git commit -m "commit for zip"
popd

git archive --format=zip -o "$1" --remote="$workdir" HEAD
```

[Share](https://stackoverflow.com/a/51316338)[Improve this answer](https://stackoverflow.com/posts/51316338/edit)Follow[edited Sep 2, 2021 at 12:16](https://stackoverflow.com/posts/51316338/revisions)[![sakra's user avatar](https://www.gravatar.com/avatar/96ffc6034e97f861f076115b56f392c8?s=64\&d=identicon\&r=PG)](https://stackoverflow.com/users/112955/sakra)[sakra](https://stackoverflow.com/users/112955/sakra)60.5k1515 gold badges167167 silver badges148148 bronze badgesanswered Jul 13, 2018 at 0:59[![DEWA Kazuyuki - 出羽和之's user avatar](https://i.stack.imgur.com/2llW1.png?s=64\&g=1)](https://stackoverflow.com/users/4506703/dewa-kazuyuki-%e5%87%ba%e7%be%bd%e5%92%8c%e4%b9%8b)[DEWA Kazuyuki - 出羽和之](https://stackoverflow.com/users/4506703/dewa-kazuyuki-%e5%87%ba%e7%be%bd%e5%92%8c%e4%b9%8b)2,3051414 silver badges5454 bronze badges

* 1For `cp` commands: prefer the use of the `-a` option instead of the `-r` option. "Everyone" uses the `-r` option while "everyone" wants the `-a` behavior... – [syme](https://stackoverflow.com/users/2304197/syme) [Sep 5, 2019 at 15:36](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment102049273_51316338)

[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)14

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 website](https://www.7-zip.org/download.html). 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!

[Share](https://stackoverflow.com/a/49285294)[Improve this answer](https://stackoverflow.com/posts/49285294/edit)Follow[edited Jul 29, 2019 at 15:52](https://stackoverflow.com/posts/49285294/revisions)[![Erik Humphrey's user avatar](https://www.gravatar.com/avatar/2c4d93c76b29ca5ac85a4515ca9dd3a4?s=64\&d=identicon\&r=PG)](https://stackoverflow.com/users/3011319/erik-humphrey)[Erik Humphrey](https://stackoverflow.com/users/3011319/erik-humphrey)34355 silver badges1818 bronze badgesanswered Mar 14, 2018 at 18:32[![Tung's user avatar](https://i.stack.imgur.com/HKRJR.jpg?s=64\&g=1)](https://stackoverflow.com/users/865603/tung)[Tung](https://stackoverflow.com/users/865603/tung)1,52944 gold badges1515 silver badges3232 bronze badges

* the bad thing is that 7zip does not support all cmd switches like `-j` – [Fritz](https://stackoverflow.com/users/2298744/fritz) [Aug 30, 2020 at 11:37](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment112566317_49285294)

[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)12

On **Windows**, you can use ***tar*** instead of ***zip***.

```
tar -a -c -f output.zip myfile.txt
```

which is same as,

```
zip output.zip myfile.txt
```

no need to install any external zip tool.

[Share](https://stackoverflow.com/a/71023414)[Improve this answer](https://stackoverflow.com/posts/71023414/edit)Followanswered Feb 7, 2022 at 18:13[![Vikram Sapate's user avatar](https://i.stack.imgur.com/PEUWv.png?s=64\&g=1)](https://stackoverflow.com/users/11361952/vikram-sapate)[Vikram Sapate](https://stackoverflow.com/users/11361952/vikram-sapate)87199 silver badges1414 bronze badges

* 2Super Idea, Very Clever. This works. – [Sriharsha Kalluru](https://stackoverflow.com/users/1005707/sriharsha-kalluru) [Feb 16, 2022 at 15:00](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment125760733_71023414)&#x20;
* Nope. This does not produce a valid zip file in Windows. It produces a tar.gz file. – [sboisse](https://stackoverflow.com/users/738808/sboisse) [Oct 6, 2022 at 21:05](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment130624726_71023414)&#x20;
* Since this was a question about git bash, the proper command would be `tar.exe -a -c -f output.zip myfile.txt` Windows delivers BSD tar which is able to create ZIP files. Git Bash provides GNU tar, which can't do the same. – [Christian](https://stackoverflow.com/users/1770720/christian) [Nov 15, 2022 at 17:15](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment131426487_71023414)&#x20;

[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)8

I use [`choco`](https://chocolatey.org/) as my Windows Package Manager.

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

```
PS > choco install 7zip.install
```

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

```
$ which 7z
/c/ProgramData/chocolatey/bin/7z
```

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

```
$ cp /c/ProgramData/chocolatey/bin/7z.exe /c/ProgramData/chocolatey/bin/zip.exe
```

[Share](https://stackoverflow.com/a/61567163)[Improve this answer](https://stackoverflow.com/posts/61567163/edit)Followanswered May 2, 2020 at 22:31[![setrar's user avatar](https://i.stack.imgur.com/1CFCo.jpg?s=64\&g=1)](https://stackoverflow.com/users/1490003/setrar)[setrar](https://stackoverflow.com/users/1490003/setrar)10322 silver badges55 bronze badges

* 1why rename 7z to zip. 7z has different command line usage from zip. – [Phani Rithvij](https://stackoverflow.com/users/8608146/phani-rithvij) [Jan 10 at 0:28](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment132465996_61567163)

[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)6

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`.

```
# man command workaround: alias can't pass flags, but can't name function man
m() {
    "$1" --help | less
}
alias man="m"
```

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.

[Share](https://stackoverflow.com/a/45597513)[Improve this answer](https://stackoverflow.com/posts/45597513/edit)Follow[edited Aug 9, 2017 at 20:56](https://stackoverflow.com/posts/45597513/revisions)answered Aug 9, 2017 at 17:51[![Dylan Kirkby's user avatar](https://i.stack.imgur.com/INWvO.png?s=64\&g=1)](https://stackoverflow.com/users/2116768/dylan-kirkby)[Dylan Kirkby](https://stackoverflow.com/users/2116768/dylan-kirkby)1,4271111 silver badges1919 bronze badges

* Interesting alternative. +1. Although `<command> --help` is often a small subset of an actual `man <command>` content – [VonC](https://stackoverflow.com/users/6309/vonc) [Aug 9, 2017 at 20:55](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment78160312_45597513)
* Creative thinking! :-) My question though was not about the `man` tool alone. And I guess the `zip` functionality is harder to emulate with bash functions & aliases. ;-) – [halloleo](https://stackoverflow.com/users/65889/halloleo) [Aug 10, 2017 at 3:58](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment78167551_45597513)

[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)5

You can install individual GNU tools from <http://gnuwin32.sourceforge.net/packages.html> such as `zip`.

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

[Share](https://stackoverflow.com/a/49355978)[Improve this answer](https://stackoverflow.com/posts/49355978/edit)Followanswered Mar 19, 2018 at 4:49[![wisbucky's user avatar](https://www.gravatar.com/avatar/ce01465deb2032903f0c1b86bc3f431e?s=64\&d=identicon\&r=PG)](https://stackoverflow.com/users/1081043/wisbucky)[wisbucky](https://stackoverflow.com/users/1081043/wisbucky)31.2k1010 gold badges140140 silver badges9898 bronze badges[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)4

Here are the steps you can follow.

1. Go to the following link <https://sourceforge.net/projects/gnuwin32/files/>
2. 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”.
3. 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
4. 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/>

[Share](https://stackoverflow.com/a/49906783)[Improve this answer](https://stackoverflow.com/posts/49906783/edit)Followanswered Apr 18, 2018 at 18:37[![sagecoder's user avatar](https://i.stack.imgur.com/yFgVf.jpg?s=64\&g=1)](https://stackoverflow.com/users/8652596/sagecoder)[sagecoder](https://stackoverflow.com/users/8652596/sagecoder)10155 bronze badges[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)3

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

[Share](https://stackoverflow.com/a/66029361)[Improve this answer](https://stackoverflow.com/posts/66029361/edit)Followanswered Feb 3, 2021 at 14:19[![Zartc's user avatar](https://www.gravatar.com/avatar/70dd3e9debf817c382d4d61969c6451f?s=64\&d=identicon\&r=PG)](https://stackoverflow.com/users/1300461/zartc)[Zartc](https://stackoverflow.com/users/1300461/zartc)14466 bronze badges

* `ln: failed to create symbolic link '/usr/bin/zip': No such file or directory` with Git bash 2.37.2.windows.2 – [Christian](https://stackoverflow.com/users/1770720/christian) [Nov 15, 2022 at 17:19](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment131426572_66029361)

[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)3

steps to install SDKMAN on windows

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

[![enter image description here](https://i.stack.imgur.com/DaGPe.png)](https://i.stack.imgur.com/DaGPe.png)

```bash
winget install -e --id GnuWin32.Zip
mkdir ~/bin
cp /usr/bin/unzip ~/bin/zip
curl -s "https://beta.sdkman.io" | bash
source "/c/Users/ajink/.sdkman/bin/sdkman-init.sh"
sdk selfupdate force
```

After you can install Java like this.

```bash
sdk install java 17.0.2-open
```

Done ! :)

[Share](https://stackoverflow.com/a/71035563)[Improve this answer](https://stackoverflow.com/posts/71035563/edit)Follow[edited Apr 8, 2022 at 7:01](https://stackoverflow.com/posts/71035563/revisions)answered Feb 8, 2022 at 14:26[![STEEL's user avatar](https://i.stack.imgur.com/SY5ID.jpg?s=64\&g=1)](https://stackoverflow.com/users/942317/steel)[STEEL](https://stackoverflow.com/users/942317/steel)8,34099 gold badges6767 silver badges8787 bronze badges[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)2

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

```
|prompt> pacman -Syu man-db
|prompt> git help archive
```

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

[Share](https://stackoverflow.com/a/58649046)[Improve this answer](https://stackoverflow.com/posts/58649046/edit)Followanswered Oct 31, 2019 at 18:06[![Sheldon Campbell's user avatar](https://www.gravatar.com/avatar/8a5fbac3a27a477dadb5b4246bac98c9?s=64\&d=identicon\&r=PG\&f=1)](https://stackoverflow.com/users/12049021/sheldon-campbell)[Sheldon Campbell](https://stackoverflow.com/users/12049021/sheldon-campbell)2122 bronze badges[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)2

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

Create a script named *zip*:

```
$ vi ~/bin/zip
```

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

```
#!/bin/bash
/c/Progra~1/7-Zip/7z.exe a "$@"
```

Finally make it executable

```
$ chmod ugo+x ~/bin/zip
```

***

This helped to make a *ytt* build script happy.

```
+ zip ytt-lambda-website.zip main ytt

7-Zip 18.01 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-01-28

Scanning the drive:
2 files, 29035805 bytes (28 MiB)

Creating archive: ytt-lambda-website.zip

Add new data to archive: 2 files, 29035805 bytes (28 MiB)
```

[Share](https://stackoverflow.com/a/63975820)[Improve this answer](https://stackoverflow.com/posts/63975820/edit)Followanswered Sep 20, 2020 at 5:30[![bvj's user avatar](https://www.gravatar.com/avatar/6b4b92ec6ac91090b0cb7ac3b9e1d447?s=64\&d=identicon\&r=PG\&f=1)](https://stackoverflow.com/users/241296/bvj)[bvj](https://stackoverflow.com/users/241296/bvj)3,2443131 silver badges2929 bronze badges[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)2

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:

```bash
zipWithZiptool() {
  # Docs: https://libzip.org/documentation/ziptool.html
  targetFilePath="$1"
  shift
  args=() # collect all args in an array so spaces are handled correctly
  while IFS=$'\n\r' read -r line; do
    if [[ -d "$line" ]]; then
      args+=("add_dir" "$line") # Add a single directory by name
    else
      # add_file <pathInZip> <pathToFile> <startIndex> <length>
      args+=("add_file" "$line" "$line" 0 -1)
    fi
  done <<< "$(find "$@")" # call find with every arg to return a recursive list of files and dirs
  ziptool $targetFilePath "${args[@]}" # quotation is important for handling file names with spaces
}
```

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

```
zipWithZiptool "my.zip" *
```

[Share](https://stackoverflow.com/a/66211685)[Improve this answer](https://stackoverflow.com/posts/66211685/edit)Followanswered Feb 15, 2021 at 16:23[![Leon S.'s user avatar](https://i.stack.imgur.com/Vc5nu.jpg?s=64\&g=1)](https://stackoverflow.com/users/3968618/leon-s)[Leon S.](https://stackoverflow.com/users/3968618/leon-s)3,27711 gold badge1818 silver badges1515 bronze badges

* It's a great idea. However, I get "Git/mingw64/bin/ziptool.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory" on my machine – [Mikaël Mayer](https://stackoverflow.com/users/1287856/mika%c3%abl-mayer) [Jun 1, 2021 at 6:31](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment119810635_66211685)
* @MikaëlMayer This seems to run without issues on several systems here, so it might be a local problem. Maybe this helps? [github.com/msys2/MINGW-packages/issues/4588](https://github.com/msys2/MINGW-packages/issues/4588) – [Leon S.](https://stackoverflow.com/users/3968618/leon-s) [Jun 1, 2021 at 13:26](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment119820955_66211685)

[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)1

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

```
PATH=$PATH:/c/cygwin/bin
export PATH
```

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

```
`cygpath -w /bin`
```

in each respective shell.

[Share](https://stackoverflow.com/a/54950904)[Improve this answer](https://stackoverflow.com/posts/54950904/edit)Followanswered Mar 1, 2019 at 19:11[![miles zarathustra's user avatar](https://www.gravatar.com/avatar/27a3fc710a31b256773bc22788b2f728?s=64\&d=identicon\&r=PG\&f=1)](https://stackoverflow.com/users/1429578/miles-zarathustra)[miles zarathustra](https://stackoverflow.com/users/1429578/miles-zarathustra)19122 silver badges55 bronze badges

* Well, the whole reason why I went down the GitBash/MSYS path was to avoid the installer driven approach of Cygwin. - If I could install Cygwin via zip files or similar (staying away from in-installer downloads) this were my first choice! – [halloleo](https://stackoverflow.com/users/65889/halloleo) [Mar 2, 2019 at 2:29](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment96671807_54950904)
* Let me guess... With Linux, you run Slackware :^) – [miles zarathustra](https://stackoverflow.com/users/1429578/miles-zarathustra) [Mar 3, 2019 at 7:46](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment96693528_54950904)

[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)0

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

```
#!/usr/bin/perl
use IO::Compress::Zip qw(:all);
$z = shift;
zip [ @ARGV ] => $z or die "Cannot create zip file: $ZipError\n";
```

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.

[Share](https://stackoverflow.com/a/54447010)[Improve this answer](https://stackoverflow.com/posts/54447010/edit)Follow[edited Feb 14, 2019 at 14:39](https://stackoverflow.com/posts/54447010/revisions)answered Jan 30, 2019 at 18:15[![mik's user avatar](https://i.stack.imgur.com/ldO4p.jpg?s=64\&g=1)](https://stackoverflow.com/users/3783352/mik)[mik](https://stackoverflow.com/users/3783352/mik)3,43533 gold badges2121 silver badges2929 bronze badges[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)0

Here is my experience, I cant run and exe or .msi files in my laptop. so downloaded filed from <https://github.com/bmatzelle/gow/wiki> > 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.

[Share](https://stackoverflow.com/a/66004807)[Improve this answer](https://stackoverflow.com/posts/66004807/edit)Followanswered Feb 2, 2021 at 6:44[![Ravi G's user avatar](https://lh4.googleusercontent.com/-Zw8puJ57eTY/AAAAAAAAAAI/AAAAAAAAB0s/AMZuucm5ssH5M6iUnPHreEtLG2mccpOUTw/photo.jpg?sz=64)](https://stackoverflow.com/users/13747041/ravi-g)[Ravi G](https://stackoverflow.com/users/13747041/ravi-g)2122 bronze badges[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)0

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 blog](https://www.medo64.com/2021/09/zip-in-git-bash/), 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:

```
perl -e '
  use strict;
  use warnings;
  use autodie;
  use IO::Compress::Zip qw(:all);
  zip [
    "src/mimetype",
    <"src/META-INF/*.*">,
    <"src/OEBPS/*.*">,
    <"src/OEBPS/chapters/*.*">
  ] => "bin/book.epub",
       FilterName => sub { s[^src/][] },
       Zip64 => 0,
  or die "Zip failed: $ZipError\n";
'
```

[Share](https://stackoverflow.com/a/72944013)[Improve this answer](https://stackoverflow.com/posts/72944013/edit)Followanswered Jul 11, 2022 at 19:58[![Marc Durdin's user avatar](https://i.stack.imgur.com/4oloY.jpg?s=64\&g=1)](https://stackoverflow.com/users/1836776/marc-durdin)[Marc Durdin](https://stackoverflow.com/users/1836776/marc-durdin)1,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... – [halloleo](https://stackoverflow.com/users/65889/halloleo) [Jul 12, 2022 at 1:24](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#comment128841407_72944013)

[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)0

1. install zip <https://gnuwin32.sourceforge.net/packages/zip.htm>
2. copy zip.exe and bzip2.dll from C:\Program Files (x86)\GnuWin32\bin to C:\Program Files\Git\mingw64\bin
3. reopen git-bash

[Share](https://stackoverflow.com/a/75254715)[Improve this answer](https://stackoverflow.com/posts/75254715/edit)Followanswered Jan 27 at 6:26[![jiaqi zhu's user avatar](https://lh5.googleusercontent.com/-9i3mB7QO4O0/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rcNhRJNdiJ28RJvB2o2YDGfjnz7Kg/photo.jpg?sz=64)](https://stackoverflow.com/users/12022352/jiaqi-zhu)[jiaqi zhu](https://stackoverflow.com/users/12022352/jiaqi-zhu)1[Add a comment](https://stackoverflow.com/questions/38782928/how-to-add-man-and-zip-to-git-bash-installation-on-windows#)-3

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

```
$ sudo apt-get update
$ sudo apt-get install zip unzip
```

[Share](https://stackoverflow.com/a/72749872)[Improve this answer](https://stackoverflow.com/posts/72749872/edit)Follow[edited Jun 24, 2022 at 22:27](https://stackoverflow.com/posts/72749872/revisions)answered Jun 24, 2022 at 22:14[![eldinT's user avatar](https://lh3.googleusercontent.com/-n2mOGEDmSto/AAAAAAAAAAI/AAAAAAAAAOE/Vp6SuFwgwl4/photo.jpg?sz=64)](https://stackoverflow.com/users/11947030/eldint)[eldinT](https://stackoverflow.com/users/11947030/eldint)52611 gold badge55 silver badges1010 bronze badges

* 1The question is about Git bash on Windows. There is no apt package manager in this environment. – [Christian](https://stackoverflow.com/users/1770720/christian)

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learnimportant.gitbook.io/learn-important/windows10/how-to-add-man-and-zip-to-git-bash-nen-zip-tar-extract-zip-ok.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
