Hot answers tagged

32

There is watch in cygwin. But it isn't installed by default. You need to install procps package to appear watch. (you can run cygwin installer again and it allows to install only the missed packages without reinstalling the whole cygwin) Instead of watch you can use simple cycle like: while true ; do check file ; sleep 2 ; done


30

Grepping around in /etc turned up a link that Googling did not. It turns out you can control this in the file /etc/fstab. Just add a line that says none / cygdrive binary 0 0 and the problem should be fixed. No more kludgey fixes in .bashrc, and no messed-up $PATH.


29

Cygwin vim ships with vim's default configuration, which leaves vim in vi compatibility mode where it tries to emulate the original vi as closely as possible. Among other limitations, arrow keys do not work in that mode, and backspace just moves the cursor left rather than erasing a character. Creating an empty ~/.vimrc is sufficient to disable vi ...


28

MinTTY - here. It makes Cygwin entirely usable on Windows. I would be lost without it. Based on the original PuTTY code, but integrates straight into Cygwin (and in fact, is bundled with Cygwin). Start it with, C:\cygwin\bin\mintty.exe - Or where-ever you installed it. The '-' is key. There are a few other useful additions for Cygwin as well, one ...


25

Does Cygwin work like wine? No. Does it provide a compatibility layer inside a foreign OS? Yes. Wine can run Windows executables on Linux, but Cygwin cannot run Linux executables on Windows. Instead, Linux programs have to be compiled specifically for Cygwin, whereby the aim of the Cygwin project is to make that as straightforward as possible, i.e. it's ...


16

$ cygstart theFile.ext This will open theFile.ext with the default app you have set for .ext files.


16

You have to use source or eval or to spawn a new shell. When you run a shell script a new child shell is spawned. This child shell will execute the script commands. The father shell environment will remain untouched by anything happens in the child shell. There are a lot of different techniques to manage this situation: Prepare a file sourcefile containg ...


12

You could do that by using the source builtin: . script_name Some shells provide an alias named source: source script_name


12

The easiest way is copy Cygwin VIM's sample vimrc file cp /usr/share/vim/vim*/vimrc_example.vim /etc/vimrc This will fix the problem for every account on your system. If, for some reason, you only want to change it for a particular user, do cp /usr/share/vim/vim*/vimrc_example.vim ~/.vimrc See reference here


12

watch is in procps, so install 'procps' package.


12

Your PATH is bad. It has Windows system directories before Cygwin directories, or maybe doesn't have Cygwin directories at all. This message comes from the Windows command find (that it reports its name as FIND in uppercase is a hint). When you start a Cygwin shell, you usually need to set the PATH. I recommend that you start a login shell (if I recall ...


10

Your error is because you are using double quotes ("), which allow the contents to be interpreted by the shell before it gets to grep. Try grep -r 'c:\\' . instead. echo 'c:\' > test ire@localhost$ cat test c:\ ire@localhost$ grep -r 'c:\\' test c:\ Explanation: \ has a special meaning, both to the shell and to grep. It's used as an escape character, ...


10

There are several different ways to do it: Specify bash as a command-line argument to mintty, as mentioned by Salton. Set the Windows SHELL environment variable to /usr/bin/bash. Make sure you have an /etc/passwd (see mkpasswd(1)) in your Cygwin environment, and set the shell for your UID to /usr/bin/bash. Cygwin doesn't supply a chsh or usermod command, ...


8

You should not use ls to parse files this way. First set extglob globstar by shopt -s extglob globstar then for f in !(*.bat) do printf '%s\n' "$f" done Using find find . -type f ! -name '*.bat' Use the negation operator for a safer treat of files.


8

To quit less, type q. Also, check out man less for some more, useful bits of information. In general, assuming man has been properly installed, man xyz will tell you how to use the xyz tool. man will normally display through less as well, so to exit from man, again you would type q.


8

Find this in .bashrc: # Make bash append rather than overwrite the history on disk # shopt -s histappend and uncomment the second line!


8

Setting only fileformat may not be enough, depending on a few factors. Try this: set fileformat=unix set fileformats=unix,dos "set nobinary To understand what these do, have a look at :help fileformats, etc. I think I am able to reproduce your issues, using the vim.exe provided by git in windows. Using the above settings fixed the problem for me. In the ...


8

Cygwin : Unix :: Peaches : Trombone (that was on my GRE ;) Given how dramatic Cygwin changes can be, I'd be really wary of having it done without my explicit consent. If you are daring, you could invoke cron to run whatever update script you might choose. If you were looking for the ill-documented setup.exe --quiet-mode for unattended operation, there it ...


7

To see what your terminal is sending when you press a key, switch to insert mode, press Ctrl+V, then the key. Most keys with most terminals send an escape sequence where only the first character is a control character; Ctrl+V inserts the next character literally, so you get to insert the whole escape sequence that way. Different terminals send different ...


7

Cygwin is based on Linux, so its utilities come from the same packages as on Linux: column from util-linux join and paste from coreutils


7

Make sure that you have the DISPLAY-variable set in your cygwin-environment: export DISPLAY=:0.0 after connecting with SSH, check if that shell also knows the correct DISPLAY-variable with: echo $DISPLAY


6

I usually run the output into less so that I can kill it via less instead using the q key. $ cmd | less Example $ cat /dev/urandom | less     After hitting q+Enter it'll quit and return back to your normal terminal, leaving it nice and clean. Why does that happen? The problem you're encountering is that there are buffers (for STDOUT) ...


6

As per the official Cygwin Installation Page: Installing and Updating Cygwin for 64-bit versions of Windows Run setup-x86_64.exe any time you want to update or install a Cygwin package for 64-bit windows. The signature for setup-x86_64.exe can be used to verify the validity of this binary using this public key. I had a hunch this bash was ...


6

Try building a cygwin port of OpenCV instead of using the windows one. Go to Cygwin ports, follow their instructions & download the "opencv" package (listed under graphics in "setup.exe"), make sure to select the "src?" checkbox. Build it. That's it.


6

Automating Cygwin Installation Source: This Wiki Page The Cygwin Setup program is designed to be interactive, but there are a few different ways to automate it. If you are deploying to multiple systems, the best way is to run through a full installation once, saving the entire downloaded package tree. Then, on target systems, run setup.exe as a ...


6

You installed cygwin, so you can just use its shell for maximum command support : "C:\Program Files\Cygwin\cygwin.bat this will give you a bash shell Then you can change directoty to go to the images location. Suppose your image location is "D:\Your Name\Images", to go there type cd "/cygdrive/d/Your Name/Images" and then call your command using the bash ...


5

Poking around with various inputs, I felt grep did its own magic for line-endings: $ printf "foo\rbar\n" | grep -oz $'\r' | od -c 0000000 \r \n 0000002 $ printf "foo\rbar\r\n" | grep -oz $'\r' | od -c 0000000 $ printf "foo\rbar\r" | grep -oz $'\r' | od -c 0000000 \r \n \r \n 0000004 (The -z was my lame attempt to make grep match everything.) And so ...


5

There is no traceroute in the Cygwin packages, because tracert is always available on Windows. See https://cygwin.com/ml/cygwin/2005-12/msg00443.html for a thread briefly discussing this. You can try compiling a Unix-style traceroute from source usign Cygwin. If you want to compare Windows-style tracert to Unix-style traceroute though, I'd recommend running ...


5

In cygwin its not possible to change group permissions, until the group is Users or Root. Refer http://stackoverflow.com/questions/17091972/chmod-cannot-change-group-permission-on-cygwin So you wont be able to change the group permission until you change var's group owner to Users So the best solution is: chown :Users /var chmod 757 /var chmod ug-s /var ...


5

Ok, I figured out the solution to my own problem. By default CygwinX no longer listens for tcp connections (Cyg SSH is using Unix sockets to connect). To enable tcp connections "-listen tcp" needs to be added to the command line parameters. In my case I changed the "XWin Server" icon to read: C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; ...



Only top voted, non community-wiki answers of a minimum length are eligible