首页 > 解决方案 > Git bash:找不到whereis命令

问题描述

我在 Windows 机器上使用 git bash。whereis除命令外,一切正常。终端告诉我找不到命令:

$ whereis grep
bash: whereis: command not found

我已经尝试添加C:\Program Files(x86)\Git\bin到我的 PATH 中。

我该如何解决?

标签: terminalgit-bash

解决方案


where在 Windows 中使用

在 Linux 中使用的命令whereis等同where于为 Windows 98 的 Windows 工具包提供的命令,并且默认包含在 Server 2003、Vista 和更新版本中:

$ where git
C:\Program Files\Git\mingw64\bin\git.exe
C:\Users\MyUser\scoop\shims\git.exe

更多信息

在 Windows 的 gitbash 中添加 .exe

当您想要.exegitbash 类型的可执行文件时,您应该添加以下路径关系:

 C:\Program Files\Git\mingw64\bin\<EXE>.exe

或者有 ubication 的文件夹git,但总是应该添加到mingw64\bin\.

whereis在 Windows 中安装

  • 您必须下载以下文件:whereis.zip

  • 解压缩后,您应该复制以下whereis.exe文件:

    mvp_tips/whereis/Debug/
    
  • 并将其复制到:

    C:\Program Files\Git\mingw64\bin\
    
  • 如果一切顺利,请关闭所有GitBash选项卡并重新打开其中一个并输入:

    $ whereis whereis
    C:\Program Files\Git\mingw64\bin\whereis.exe #And what should come out if everything is correct:
    

下载和安装脚本

运行Git BashRun As Administrator

#!/bin/bash
wget www.flounder.com/whereis.zip
unzip whereis.zip
cd mvp_tips/whereis/Debug/
cp whereis.exe 'C:\Program Files\Git\mingw64\bin\'
source ~/.bashrc
whereis whereis

推荐阅读