I'm running Cygwin 64-bit on Windows.
When I launch an instance of mintty
using the "Cygwin64 Terminal" desktop shortcut that comes with the Cygwin installation, it runs fine and all installed commands work.
However, when I launch mintty.exe
, from where it's contained at C:\cygwin64\bin
, I get a command not found
error.
I also have an AutoHotKey script set up that launches a mintyy.exe instance at the Desktop directory on the press of a NumPad key. When mintyy
is launched this way, it also gives a command not found
error. cd
ing to any other directory, or doing cd
on its own, doesn't fix this either. All that seems to matter is where the mintty instance was initially run from.
A few of the commands that display errors are:
killall
man
info
wc
which
ssh
clear
Most of these are included as part of the base Cywgin package, and are therefore definitely installed as part of the Cygwin instllation, so I'm really not sure what's going on here.
Commands that do work generally seem to be limited to those listed when I do help
in the terminal. Here's the whole ouput of that command.
$ help
GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)
These shell commands are defined internally. Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.
job_spec [&] history [-c] [-d offset] [n] or hist>
(( expression )) if COMMANDS; then COMMANDS; [ elif C>
. filename [arguments] jobs [-lnprs] [jobspec ...] or jobs >
: kill [-s sigspec | -n signum | -sigs>
[ arg... ] let arg [arg ...]
[[ expression ]] local [option] name[=value] ...
alias [-p] [name[=value] ... ] logout [n]
bg [job_spec ...] mapfile [-d delim] [-n count] [-O or>
bind [-lpsvPSVX] [-m keymap] [-f file> popd [-n] [+N | -N]
break [n] printf [-v var] format [arguments]
builtin [shell-builtin [arg ...]] pushd [-n] [+N | -N | dir]
caller [expr] pwd [-LP]
case WORD in [PATTERN [| PATTERN]...)> read [-ers] [-a array] [-d delim] [->
cd [-L|[-P [-e]] [-@]] [dir] readarray [-n count] [-O origin] [-s>
command [-pVv] command [arg ...] readonly [-aAf] [name[=value] ...] o>
compgen [-abcdefgjksuv] [-o option] [> return [n]
complete [-abcdefgjksuv] [-pr] [-DE] > select NAME [in WORDS ... ;] do COMM>
compopt [-o|+o option] [-DE] [name ..> set [-abefhkmnptuvxBCHP] [-o option->
continue [n] shift [n]
coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname ...]
declare [-aAfFgilnrtux] [-p] [name[=v> source filename [arguments]
dirs [-clpv] [+N] [-N] suspend [-f]
disown [-h] [-ar] [jobspec ... | pid > test [expr]
echo [-neE] [arg ...] time [-p] pipeline
enable [-a] [-dnps] [-f filename] [na> times
eval [arg ...] trap [-lp] [[arg] signal_spec ...]
exec [-cl] [-a name] [command [argume> true
exit [n] type [-afptP] name [name ...]
export [-fn] [name[=value] ...] or ex> typeset [-aAfFgilnrtux] [-p] name[=v>
false ulimit [-SHabcdefiklmnpqrstuvxPT] [l>
fc [-e ename] [-lnr] [first] [last] o> umask [-p] [-S] [mode]
fg [job_spec] unalias [-a] name [name ...]
for NAME [in WORDS ... ] ; do COMMAND> unset [-f] [-v] [-n] [name ...]
for (( exp1; exp2; exp3 )); do COMMAN> until COMMANDS; do COMMANDS; done
function name { COMMANDS ; } or name > variables - Names and meanings of so>
getopts optstring name [arg] wait [-n] [id ...]
hash [-lr] [-p pathname] [-dt] [name > while COMMANDS; do COMMANDS; done
help [-dms] [pattern ...] { COMMANDS ; }
However, even more confusingly, ping
is not part of this list, but also works.
Anyone have any idea what's going on here?
Best Answer
C:\cygwin64\
there should fileCygwin.bat
(it will runbash
in Windows's terminal aka CMD), use it instead ofmintty
or if you prefermintty
console then you need to start it as\full\path\to\mintty -
(the dash-
character is part of the command !!! ) to setup correctly cygwin's environment. Correct this in your " AutoHotKey script" to resolve your issue.The dash
-
character on the end ofmintty
do the same asbash -l
- it used as login shell. If you usingmintty
without dash on the end it behave as ordinary exe file without setup cygwin environment, but with-
option it emulate normal "login" to the system.killall man info wc which ssh clear
installed by running
cygwin
installation filesetup.exe
again and type these program in search field, you will see in the list if they checked as installed or not. Check to install them and proceed next if it isn't marked as installed.ping
you running windows version of ping, not cygwin's, if you installedping
package when you installedcygwin
you need to call it with full path where it locatedC:\cygwin64\bin\ping.exe
(or/bin/ping
if you inside of cygwin's terminal), otherwise window's version ofping
will be executed.Cygwin can be used in two modes of operation: one, it when you call cygwin's utility directly from any windows programs or bat files (use
grep
for example in your bat files), second mode of operation when you want to emulate unix based operation system, to do that you need to login to the virtual operation system aka cygwin, this way mintty - terminal ( orbash -l
) will setup properly all environment as it is when you login to real unix based operation system.