📄 how-using.texinfo
字号:
cause. Then use the Windows System find utility to search your wholemachine, not just components in your PATH (as 'type' would do) orcygwin-mounted filesystems (as Cygwin 'find' would do).@subsection Where can I find "more"?If you are looking for the "more" pager, you should use the "less" pagerinstead.@subsection Why isn't package XXXX available in Cygwin? (Or, why is your package so out of date?)Probably because there is nobody willing or able to maintain it. Ittakes time, and the priority for the Cygwin Team is the Cygwin package.The rest is a volunteer effort. Want to contribute? See below.@subsection How can I access other drives?You have some flexibility here.Cygwin has a builtin "cygdrive prefix" for drives that are not mounted.You can access any drive, say Z:, as '/cygdrive/z/'.In some applications (notably bash), you can use the familiar windows<drive>:/path/, using posix forward-slashes ('/') instead of Windowsbackward-slashes ('\'). (But see the warning below!) This maps in theobvious way to the Windows path, but will be converted internally to usethe Cygwin path, following mounts (default or explicit). For example:@example bash$ cd C:/Windows bash$ pwd /cygdrive/c/Windows@end exampleand@example bash$ cd C:/cygwin bash$ pwd /@end examplefor a default setup. You could also use backward-slashes in theWindows path, but these would have to be escaped from the shell.@strong{Warning:} There is some ambiguity in going from a Windows pathto the posix path, because different posix paths, through differentmount points, could map to the same Windows directory. This mattersbecause different mount points may be binmode or textmode, so thebehavior of Cygwin apps will vary depending on the posix path used toget there.You can avoid the ambiguity of Windows paths, and avoid typing"/cygdrive", by explicitly mounting drives to posix paths. For example:@example bash$ mkdir /c bash$ mount c:/ /c bash$ ls /c@end exampleThen @samp{/cygdrive/c/Windows} becomes @samp{/c/Windows} which is alittle less typing.Note that you only need to mount drives once. The mapping is keptin the registry so mounts stay valid pretty much indefinitely.You can only get rid of them with umount, or the registry editor.The '-b' option to mount mounts the mountpoint in binary mode("binmode") where text and binary files are treated equivalently. Thisshould only be necessary for badly ported Unix programs where binaryflags are missing from open calls. It is also the setting for /,/usr/bin and /usr/lib in a default Cygwin installation. The default fornew mounts is text mode ("textmode"), which is also the mode for all"cygdrive" mounts.You can change the default @samp{cygdrive} prefix and whether it isbinmode or textmode using the @code{mount} command. For example,@example bash$ mount -b --change-cygdrive-prefix cygdrive@end examplewill change all @code{/cygdrive/...} mounts to binmode.@subsection How can I copy and paste into Cygwin console windows?First, consider using rxvt instead of the standard console window. Inrxvt, selecting with the left-mouse also copies, and middle-mousepastes. It couldn't be easier!Under Windows NT, open the properties dialog of the console window.The options contain a toggle button, named "Quick edit mode". It mustbe ON. Save the properties.Under Windows 9x, open the properties dialog of the console window.Select the Misc tab. Uncheck Fast Pasting. Check QuickEdit.You can also bind the insert key to paste from the clipboard by adding the following line to your .inputrc file: @example "\e[2~": paste-from-clipboard @end example @subsection What does "mount failed: Device or resource busy" mean?@strong{(Please note: This section has not yet been updated for the latestnet release.)}This usually means that you are trying to mount to a locationalready in use by mount. For example, if c: is mounted as '/'and you try to mount d: there as well, you will get this errormessage. First "umount" the old location, then "mount" the new one andyou should have better luck.If you are trying to umount '/' and are getting this message, you mayneed to run @code{regedit.exe} and change the "native" key for the '/'mount in one of the mount points kept underHKEY_CURRENT_USER/Software/Red Hat, Inc./CYGWIN.DLL setup/<version>where <version> is the latest registry version associated with theCygwin library.@subsection How can I share files between Unix and Windows?During development, we have both Unix boxes running Samba andNT/Windows 95/98 machines. We often build with cross-compilersunder Unix and copy binaries and source to the Windows systemor just toy with them directly off the Samba-mounted partition.On dual-boot NT/Windows 9x machines, we usually use the FATfilesystem so we can also access the files under Windows 9x.@subsection Are mixed-case filenames possible with Cygwin?Several Unix programs expect to be able to use to filenamesspelled the same way, but with different case. A prime exampleof this is perl's configuration script, which wants @code{Makefile} and@code{makefile}. WIN32 can't tell the difference between files withjust different case, so the configuration fails.In releases prior to beta 16, mount had a special mixed case optionwhich renamed files in such a way as to allow mixed case filenames. Wechose to remove the support when we rewrote the path handling code forbeta 16. The standard Windows apps -- explorer.exe,cmd.exe/command.com, etc. -- do not distinguish filenames that differedonly in case, resulting in some (very) undesirable behavior.Sergey Okhapkin had maintained a mixed-case patch ('coolview') untilabout B20.1, but this has not been updated to recent versions of Cygwin.@subsection What about DOS special filenames?Files cannot be named com1, lpt1, or aux (to name a few); either asthe root filename or as the extension part. If you do, you'll havetrouble. Unix programs don't avoid these names which can make thingsinteresting. E.g., the perl distribution has a file called@code{aux.sh}. The perl configuration tries to make sure that@code{aux.sh} is there, but an operation on a file with the magicletters 'aux' in it will hang.@subsection When it hangs, how do I get it back?If something goes wrong and the tools hang on you for some reason (easyto do if you try and read a file called aux.sh), first try hitting ^C toreturn to bash or the cmd prompt.If you start up another shell, and applications don't run, it's a goodbet that the hung process is still running somewhere. Use the TaskManager, pview, or a similar utility to kill the process.And, if all else fails, there's always the reset button/power switch.This should never be necessary under Windows NT.@subsection Why the weird directory structure?Why do /lib and /usr/lib (and /bin, /usr/bin) point to the same thing?Why use mounts instead of symbolic links?Can I use a disk root (e.g., C:\) as Cygwin root? Why is this discouraged?After a new installation in the default location, your mount points willlook something like this:@example bash$ mount C:\cygwin\bin on /usr/bin type system (binmode) C:\cygwin\lib on /usr/lib type system (binmode) C:\cygwin on / type system (binmode)@end example(Exactly what you see depends on what options you gave to @code{setup.exe}.)Note that /bin and /usr/bin point to the same location, as do /lib and/usr/lib. This is intentional, and you should not undo these mountsunless you @emph{really} know what you are doing.Various applications and packages may expect to be installed in /lib or/usr/lib (similarly /bin or /usr/bin). Rather than distinguish betweenthem and try to keep track of them (possibly requiring the occasionalduplication or symbolic link), it was decided to maintain only oneactual directory, with equivalent ways to access it.Symbolic links had been considered for this purpose, but were dismissedbecause they do not always work on Samba drives. Also, mounts arefaster to process because no disk access is required to resolve them.Note that non-cygwin applications will not observe Cygwin mounts (orsymlinks for that matter). For example, if you use WinZip to unpack thetar distribution of a Cygwin package, it may not get installed to thecorrect Cygwin path. @emph{So don't do this!}It is strongly recommended not to make the Cygwin root directory thesame as your drive's root directory, unless you know what you are doingand are prepared to deal with the consequences. It is generally easierto maintain the Cygwin hierarchy if it is isolated from, say, C:\. Forone thing, you avoid possible collisions with other (non-cygwin)applications that may create (for example) \bin and \lib directories.(Maybe you have nothing like that installed now, but who knows aboutthings you might add in the future?)@subsection How do anti-virus programs like Cygwin?Users have reported that NAI (formerly McAfee) VirusScan for NT (andothers?) is incompatible with Cygwin. This is because it tries to scanthe newly loaded shared memory in cygwin1.dll, which can cause fork() tofail, wreaking havoc on many of the tools. (It is not confirmed thatthis is still a problem, however.)There have been several reports of NAI VirusScan causing the system tohang when unpacking tar.gz archives. This is surely a bug in VirusScan,and should be reported to NAI. The only workaround is to disableVirusScan when accessing these files. This can be an issue duringsetup, and is discussed in that FAQ entry.Some users report a significant performance hit using Cygwin when theiranti-virus software is enabled. Rather than disable the anti-virussoftware completely, it may be possible to specify directories whosecontents are exempt from scanning. In a default installation, thiswould be @samp{@code{C:\cygwin\bin}}. Obviously, this could beexploited by a hostile non-Cygwin program, so do this at your own risk.@subsection Is there a Cygwin port of GNU Emacs?Yes! It uses the X11 (@file{http://cygwin.com/xfree/}) Windowsinterface. From a remote login shell, this ``emacs -nw'' works fine.There is also a non-X11 version which just provides the text-onlyterminal interface. Use Cygwin Setup to install either one (or both).@subsection What about NT Emacs?If you want GNU Emacs with a native Microsoft Windows interface, butwithout X, then you must use the native Windows port, commonly knownas ``NT Emacs''. You get NT Emacs from any GNU mirror. It is notavailable from Cygwin Setup.NT Emacs uses the Windows command shell by default. Since it is not aCygwin application, it has no knowledge of Cygwin mounts. With thosepoints in mind, you need to add the following code to your ~/.emacs(or ~/_emacs) file in order to use Cygwin bash. This is particularly usefulfor the JDEE package (@file{http://jdee.sunsite.dk/}). The followingsettings are for Emacs 21.1:@example ;; This assumes that Cygwin is installed in C:\cygwin (the ;; default) and that C:\cygwin\bin is not already in your ;; Windows Path (it generally should not be). ;; (setq exec-path (cons "C:/cygwin/bin" exec-path)) (setenv "PATH" (concat "C:\\cygwin\\bin;" (getenv "PATH"))) ;; ;; NT-emacs assumes a Windows command shell, which you change ;; here. ;; (setq process-coding-system-alist '(("bash" . undecided-unix))) (setq shell-file-name "bash") (setenv "SHELL" shell-file-name) (setq explicit-shell-file-name shell-file-name) ;; ;; This removes unsightly ^M characters that would otherwise ;; appear in the output of java applications. ;; (add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m)@end exampleIf you want NT Emacs to understand Cygwin paths, getcygwin-mount.el from @file{http://www.emacswiki.org/elisp/index.html}.Note that all of this ``just works'' if you use the Cygwin port ofEmacs from Cygwin Setup.@subsection What about XEmacs?For a concise description of the current situation with XEmacs, seethis message from the Cygwin mailing list:@file{http://cygwin.com/ml/cygwin/2002-11/msg00609.html}.@subsection Is there a better alternative to the standard console window?Yes! Use rxvt instead. It's an optional package in Cygwin Setup.You can use it with or without X11. You can resize it easily bydragging an edge or corner. Copy and paste is easy with the left andmiddle mouse buttons, respectively. It will honor settings in your~/.Xdefaults file, even without X.Don't invoke as simply ``rxvt'' because that will run /bin/sh (reallyash) which is not a good interactive shell. For details see@code{/usr/doc/Cygwin/rxvt-<ver>.README}.@subsection info error "dir: No such file or directory"Cygwin packages install their info documentation in the /usr/infodirectory. But you need to create a @code{dir} file there before thestandalone info program (probably @code{/usr/bin/info}) can be used toread those info files. This is how you do it:@example bash$ cd /usr/info bash$ for f in *.info ; do install-info $f dir ; done@end exampleThis may generate warnings:@example install-info: warning: no info dir entry in `gzip.info' install-info: warning: no info dir entry in `time.info'@end exampleThe @code{install-info} command cannot parse these files, so you willhave to add their entries to @code{/usr/info/dir} by hand.Even if the dir file already exists, you may have to update it whenyou install new Cygwin packages. Some packages update the dir filefor you, but many don't.@subsection Why do I get a message saying Out of Queue slots?"Out of queue slots!" generally occurs when you're trying to removemany files that you do not have permission to remove (either becauseyou don't have permission, they are opened exclusively, etc). Whathappens is Cygwin queues up these files with the supposition that itwill be possible to delete these files in the future. Assuming thatthe permission of an affected file does change later on, the file willbe deleted as requested. However, if too many requests come in todelete inaccessible files, the queue overflows and you get the messageyou're asking about. Usually you can remedy this with a quick chmod,close of a file, or other such thing. (Thanks to Larry Hall forthis explanation).@subsection Why don't symlinks work on samba-mounted filesystems?Symlinks are marked with "system" file attribute. Samba does notenable this attribute by default. To enable it, consult your Sambadocumentation and then add these lines to your samba configurationfile:@smallexample map system = yes create mask = 0775@end smallexampleNote that the 0775 can be anything as long as the 0010 bit is set.@subsection Why does df report sizes incorrectly.There is a bug in the Win32 API function GetFreeDiskSpace thatmakes it return incorrect values for disks larger than 2 GB in size.Perhaps that may be your problem?@subsection Why doesn't Cygwin tcl/tk understand Cygwin paths?The versions of Tcl/Tk distributed with Cygwin (e.g. cygtclsh80.exe,cygwish80.exe) are not actually "Cygwin versions" of those tools.They are built with the @samp{-mno-cygwin} option to @code{gcc}, whichmeans they do not understand Cygwin mounts or symbolic links.See the entry "How do I convert between Windows and UNIX paths?"elsewhere in this FAQ.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -