Cygwin: `find / -name libstdc++-6.dll` shows no results

0

1

In Windows Explorer, when I search for libstdc++-6.dll, it returns half a dozen results. I'm trying to do a similar filename search in Cygwin with find, but that shows no results.

find / -name libstdc++-6.dll

Is my syntax correct?

This should invoke Cygwin find, as which find returns /bin/find.

Update

find /c/strawberry/ -name libstdc++-6.dll works, just not from root.

mcandre

Posted 2013-05-07T16:51:24.917

Reputation: 2 696

Answers

1

Your syntax is correct; the gotcha here is a bit of weirdness with Cygwin's view of the filesystem.

In Cygwin, the root directory / points to what, in the Windows filesystem, is the root of your Cygwin install, which is usually c:\cygwin. To access anything outside that, you canonically have to use /cygdrive/[drive letter]; for example, the c:\windows\system32 directory's path within Cygwin is not /c/windows/system32 but rather /cygdrive/c/windows/system32.

A common way of circumventing this annoyance is to create symlinks in / which point to various drive letters in /cygdrive, e.g. ln -s /cygdrive/c /c; if you're able to access files outside the Cygwin root with paths such as /c/windows/..., it's because such symlinks exist, whether created by hand or automatically.

This scheme works well for most purposes, but not all programs automatically follow symlinks, and find is such a program; find /c/strawberry/ ... works because you're starting find off on the 'far' side of the symlink, but find / ... doesn't because it starts out on the 'near' side and won't by default follow the /c symlink. To produce the desired behavior, pass the -L option to find; find -L / -name libstdc++-6.dll should turn up the same results as find /c/strawberry -name libstdc++-6.dll will.

Aaron Miller

Posted 2013-05-07T16:51:24.917

Reputation: 8 849

Thanks dude! Unfortunately, Git Bash's find does not seem to have a -L option. – mcandre – 2013-05-07T18:06:08.177

Cygwin's find does, I'm pretty sure; if that's what you're invoking, as described in your question, then it should be working properly. If your Cygwin install came with Git Bash, then I have no idea what weirdness it's inflicting on you, and my advice is to ditch the training wheels and just install real Cygwin, whose package manager offers the git client. – Aaron Miller – 2013-05-07T18:11:08.350

Oh, hey, Git Bash comes with MSYS, which compares with Cygwin roughly as Minix compares with Linux. I'd definitely ditch Git Bash and install Cygwin, along with the Cygwin git client. – Aaron Miller – 2013-05-07T18:25:02.843

I'll look into that. Can you also try out msysGit and compare?

– mcandre – 2013-05-07T18:39:41.880

1Not having a Windows box handy at the moment, I can't, no. But I can say that Cygwin, by design, provides a much more complete *nix environment than MSYS does, also by design. If you just want to use the git command-line client, Git Bash will suffice; if it's a more general *nix interface you're after, such as being able to use find instead of Windows Search, then Cygwin's going to do a better job fulfilling that desire. – Aaron Miller – 2013-05-07T18:49:24.427

That said, I seem unintentionally to have stumbled into something of a minor religious war...

– Aaron Miller – 2013-05-07T18:49:47.770

Oh, not another one of those. I've recently fallen in love with Emacs, but I don't think anyone should necessarily convert from Vim. – mcandre – 2013-05-07T19:01:56.643

1That's more of a major religious war, I'd say. :) There's a qualitative difference, though; while you can pretty much do in Vim whatever you'd do in Emacs, or vice versa, the same really isn't true of MSYS and Cygwin. – Aaron Miller – 2013-05-07T19:06:55.083