Hot answers tagged

76

There is watch in cygwin. But it isn't installed by default. You need to install procps-ng 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 where check is your ...


51

To quit less, type q. Also, check out man less, or type h from within 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. On GNU systems like Cygwin or what you call Linux at least, man will usually display through less as well, so to exit from man, again you ...


40

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

You have Windows-style line endings. The no-op command : is instead read as :<carriage return>, displayed as :\r or more fully as $':\r'. Run dos2unix scriptname and you should be fine. If you don't have dos2unix, the following should work almost anywhere (and I tested on MobaXterm on Windows): vi -b filename Then in vi, type: :%s/\r$// :x You'...


28

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


27

Unix GUI programs display through an X server. Cygwin doesn't automatically start an X server. You need to install the packages xorg-server and xinit, and run startxwin.


22

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


20

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


19

I just ran into this problem connecting to a headless RHEL7 server. You need the xorg-x11-xauth package installed on your host in order for the DISPLAY variable to get set, and to be properly authorized. Hope I saved somebody some time.


16

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


16

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


15

I got PDFtk commands with Cygwin by installing the server version of PDFtk (https://www.pdflabs.com/tools/pdftk-server/) in Windows 7 64bits. While installing PDFtk Server, make sure to check the box saying to apply PDFtk to the system environment. Once the installation is done, type "pdftk" in Cygwin and it should give the expected results.


14

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, so ...


13

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

Method one mount -c / mount -m > /etc/fstab Method two echo - / cygdrive acl > /etc/fstab Example


12

For non-GNU versions of grep, which are unlikely to have -z, or if portability is required... grep -q pattern file && cat file -q suppresses any output but, per usual, exit status is set based on whether or not a pattern match was found. With a pattern match grep returns the success code 0 which is equivalent to true and that allows the cat command ...


11

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


11

A WoL magic packet can be sent either to UDP port 0, 7, or 9 (depending on the hardware in use) or as a raw Ethernet packet of type 0x0842. wolcmd has elected to use the former method, defaulting to port 7. Note that wolcmd does support UDP broadcast, meaning that you can specify 255.255.255.255 as the address and mask if your hardware and network support ...


10

Reviving an old thread; however, I stumbled across this while doing my own search. So rather than make a new thread - Here's what I found: http://babun.github.io/ The core of Babun consists of a pre-configured Cygwin. Cygwin is a great tool, but there’s a lot of quirks and tricks that makes you lose a lot of time to make it actually 'usable'. Not ...


10

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


10

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


10

Because your last login was from comcast.net I am guessing that you are connecting from a home system where you are behind a router which is doing NAT. A problem that a system doing NAT has is knowing when the connection is no longer wanted. If the connection is taken down cleanly then there is no problem but if the two machines just reboot then there is no ...


10

Most probably, that file is encoded in UTF-16, that is with 2 or 4 bytes per characters, probably even with a Byte-Order-Mark at the beginning. The characters that are shown in your sample (all ASCII characters) are typically encoded on 2 bytes, the first or second of which (depending on whether it's a big-enfian or little-endian UTF-16 encoding) being 0 ...


10

This is due to the script having been saved by an editor that uses DOS line-endings (such as Notepad++, for example). You will have to remove these from your scripts. To do this, either use dos2unix on the script file, or $ tr -d '\r' <script >script.new && mv script.new script (this will remove all carriage returns from anywhere in the ...


9

A few things wrong in your code: Using unquoted command substitution ($(...)) without setting $IFS Leaving expansions unquoted is the split+glob operator. The default is to split on space, tab and newline. Here, you only want to split on newline, so you need to set IFS to that as otherwise that means that will not work properly if filenames contain space ...


9

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; /...


9

Source : CygwinX FAQ : Since X server 1.17, by default the server does not listen for TCP/IP connections, only accepting local connections on a unix domain socket. For local clients, use DISPLAY=:0.0, rather than DISPLAY=localhost:0.0, DISPLAY=127.0.0.1:0.0, DISPLAY=::1:0.0, etc If it does not work (if you are connecting from remote): Use the -listen tcp ...


9

Save this to a file, let's say patterns.awk, then call awk -f patterns.awk patterns data, where patterns is your first file, and data the second: NR == FNR { prefix[NR] = $0; pattern[NR] = $2; count++; next; } { for (i = 1; i <= count; i++) { if (index($1, pattern[i]) > 0) { print prefix[i] " " $0; ...


8

Apparently procps is outdated, watch can now be found in the procps-ng package.


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.


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