1. Access windows disk in Cygwin
Cd/cygdrive/c
CD C:
2. Consolidate Cygwin commands to Windows
Assuming that Cygwin is installed in D:/develop/cygwin, add D:/develop/cygwin/bin to the system variable path (preferably in front of windows, so that, if you have the same command, the Cygwin command is executed first. Rather than Windows commands, such as Find)
You can perform the tar czvf xxx.tgz directly under Cmd.exe.
Basically all the commands can be used, including ls,more,less,find,grep and so on.
3. Use tgz Backup
Add Cygwin bin to path
Build a BAT file:
@echo off
D:
CD D:\website\8thmanage
Tar czvf 8thmanage.tgz 8thmanage
4.Windows using shell Script
Add Cygwin bin to path
In the $cygwin directory/var/to build a script t.sh, note that t.sh inside the path, are relative to the $cygwin, which need to access the C disk, please use/cygdrive/c/
To perform under Windows:
D:\cygwin\bin\bash d:\cygwin\var\t.sh
(Can be performed on a regular basis)
5. Synchronizing Windows system users
Mkpasswd-l >/etc/passwd
Mkgroup-l >/etc/group
If you have domain, you need to add-D domainname
6. Installation System Services
Cygrunsrv
Use rsync under 7.cygwing
A. Installing the Rsync component
B. Entering the Cygwin, configuring the server
Vi/etc/rsyncd.conf
... screts File=/etc/tom.ipaddr.pas
Configuration file, refer to another article in Rsync I wrote, note: Password file permissions must be 0400
chmod 0400/etc/tom.ipaddr.pas
C. Start the service side
Rsync--daemon
D. Client synchronization
Under the Cygwin of the client, run Rsync sync, please refer to another article in rsync for a specific command.
8.cygwin Use of sshd
A. Need to install the CYGRUNSRC,OPENSSH
B. Run Ssh-host-config-y
All the way back, until the appearance of cygwin=, enter the TTY ntsec, and then return,
(or, add a system environment variable cugwin=nesec TTY)
C. The SSHD service has been installed to your Windows service and can be started and closed directly in the service.
(Cygrunsrc-s sshd or net start sshd)
9. Chinese display
VI ~/.BASHRC
# Let LS and dir command display Chinese and color
Alias ls= ' ls--show-control-chars--color '
Alias dir= ' Dir-n--color '
# Set to Chinese environment so that prompts become Chinese
Export lang= "ZH_CN. GBK "
# output is encoded in Chinese
Export output_charset= "GBK"
~/.INPUTRC for
Set Completion-ignore-case on
Set Meta-flag on
Set Output-meta on
Set Convert-meta off
The Cygwin.bat script is:
@echo off
Set Make_mode=unix
--------------------------------
Installation
You can download a setup program directly to http://www.cygwin.com, Setup.exe, this program is just a setup program, all modules will be downloaded from the network installation. Alternatively, you can download a cygwin.iso image, directly image as a CD-ROM, and then install it locally from the CD, which can be a lot quicker and don't worry about disconnection.
Chinese support under X
Locale Support
Cygwin's locale support has always been problematic, but the X program can also use Xlocale.
Suggest or use ZH_CN.GBK, do not use ZH_CN. GB2312
In porting the program need to be careful not to let the program connect Libcygwin.a inside setlocale, but use libx11.a inside _xsetlocale. The method is to check the entire source code of the migrated program and discover
#include
is modified to
#define X_locale
#include
Also note that the program's connection library is to add-lx11.
If the results are not sure, you can find a dependency walker to see if the program is connected to the cygwin1.dll inside the setlocale, if it is, it means that there are omissions.
Chinese fonts
PCF Lattice Font
Gtk1.x and some of the other old X programs are all in x font,
Note that you must have a font that is encoded in accordance with locale, such as a font that must be encoded by the GBK with ZH_CN.GBK, ZH_CN. GB2312 have to have GB2312 encoded fonts.
If you use ZH_CN. GB2312, here's a redoffice with a dot-matrix font pack.
The BDF format can be extracted from the TTF by TTF2BDF, and then the font file in PCF format is obtained by BDF2PCF.
(There is a version of Windows TTF2BDF, you can convert the Windows TTF font out of the BDF font, pay attention to BDF to manually edit the file header, the encoding declaration correct)
Have
After the font, put it in a directory, perform Mkfontdir generation Fonts.dir, and then use Xset +FP
/path/to/your/fonts the font path to join (note that unlike the Fontconfig configuration, where the path is not recursive, if some fonts are placed in a subdirectory,
Subdirectories also need to be added in order to do so.
TTF fonts
Many new applications, such as GTK2, use fontconfig/libxft2 to display fonts, which support TTF fonts (x FreeType, XFT modules also support TTF fonts, but not very good support for CJK fonts. And also does not seem to have these modules under the Cygwin)
You can use the Arphic font pack under Linux completely. If you do not have Linux installed, you can download the appropriate package to http://packages.debian.org, and then extract the TTF file with 7zip decompression.
After you get the font file, put it under a directory, edit/etc/fonts/local.conf, and add the font path to:
/path/to/my/ttf/fonts If you just use it, you can put the font file under ~/.fonts, you do not need to modify any configuration, up to 30 seconds fontconfig will be able to find these fonts.
Chinese Input Method
Old Huang (HZHR) transplanted minichinput to Cygwin, I also transplanted fcitx-1.8.5 and 3.0, all can find Http://www.oliwen.com/bama from my website ...
Lc_ctype and xmodifiers are generally set up to activate input input methods in the program (unless this program has no Xim support):
For FCITX, xmodifiers settings are possible (but must be set), so chinput and FCITX can be used correctly when set to "@im =chinput"
Backspace and Delete keys in VI
First, make sure $TERM is set to Cygwin
Echo $TERM
If not, please set
TERM = Cygwin
Export TERM
Backspace and delete these two keys in normal condition only one useful. You can select one of the $HOME/.bash_profile to use
Stty Erase ' ^h '//ctrl+v, ctrl+h
Stty erase ' ^? '
------------------------
Cygwin use guide
1 Introduction
Cygwin is a UNIX simulation environment running on a Windows platform, a free software developed by Cygnus Solutions (the company has developed a lot of good things, notably Ecos, but has now been Redhat acquired). It is useful for learning unix/linux operating environments, or porting applications from UNIX to Windows, or doing some special development work, especially using the GNU toolset for Embedded system development on Windows. With the growing popularity of embedded system development in China, more and more developers have become interested in Cygwin. This article will give an introduction to it.
2 mechanism
Cygnus initially improved gcc,gdb,gas and other development tools to enable them to generate and interpret Win32 target files. They then ported the tools to the Windows platform. One scenario is to drastically modify the source code of these tools based on the Win32 API, which obviously requires a lot of work. So they took a different approach-they wrote a shared library (the Cygwin DLL) that encapsulates the Unix-style calls (such as fork,spawn,signals,select,sockets, etc.) that are not in the Win32 API, which means They wrote a simulation layer of UNIX system libraries based on the Win32 API. Thus, by connecting the source code of these tools with the shared library, you can use the cross compilers on the UNIX host to build a toolset that can run on the Windows platform. Based on these development tools ported to the Windows platform, Cygnus is migrating to Windows with other tools (almost no need to modify the source code, just to modify their configuration scripts). In this way, running bash and development tools and user tools on the Windows platform feels like working on Unix.
For a more detailed description of the Cygwin implementation, refer to http://cygwin.com/cygwin-ug-net/highlights.html.
3 Installation Settings Cygwin
3.1 Installation
To install the network version of the Cygwin, you can go to http://cygwin.com, click "Install Cygwin now!". This will first download a GUI installer called Setup.exe, which can download a complete cygwin. It is easy to install according to the instructions of each screen.
3.2 Environment variables
Before you start to run bash, you should set some environment variables. Cygwin provides a. bat file in which the most important environment variables are already set. It's the safest way to start bash. This. bat file is installed in the root directory where Cygwin resides. You are free to edit the file.
The Cygwin variable is used to make a variety of global settings for the Cygwin run-time system. At the beginning, you can set it to TTY without setting Cygwin or in a DOS box with a format similar to the following before you execute bash
C:\> Set Cygwin=tty notitle glob
The path variable is a list of paths to search for knowable files by the Cygwin application. When a Cygwin process is started, the variable is from Windows format (e.g. C:\WinNT\system32; C:\WinNT) into UNIX format (e.g.,/winnt/system32:/winnt). If you want to be able to use the Cygwin toolset without running bash, the path should at least contain x:\cygwin \ bin, where X:\cygwin is the Cygwin directory on your system.
The home variable is used to specify the master directory, and it is recommended that the variable be defined before bash is executed. When the Cygwin process is started, the variable is also converted from Windows format to UNIX format, for example, the value of home on the author's machine is c:\ (DOS command set home can see his value, set Home=xxx can be configured), in bash with echo $ Home look, its value is/cygdrive/c.
The term variable specifies the terminal type. If the beauty sets it, it is automatically set to Cygwin.
Ld_library_path is Cygwin function dlopen () as a list of paths to search for. dll files, which are also converted from Windows format to UNIX format. Most Cygwin applications do not use Dlopen and therefore do not need the variable.
3.3 Change the maximum storage capacity of Cygwin
The Cygwin program can allocate no more memory than 384 MB (program+data) by default. In most cases, you do not need to modify this restriction. However, if more actual or virtual memory is required, you should modify the HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER sections of the registry. Tian Jia a DWORD key HEAP_CHUNK_IN_MB and set its value to the desired memory limit in decimal MB. You can also use the Regtool in Cygwin to complete this setting. Examples are as follows:
Regtool-i set/hklm/software/cygnus\ SOLUTIONS/CYGWIN/HEAP_CHUNK_IN_MB 1024
Regtool-v list/hklm/software/cygnus\ Solutions/cygwin
4 using Cygwin
This section is about the differences between Cygwin and traditional UNIX systems.
4.1 Mapping path names
4.1.1 Introduction
Cygwin supports both the Win32 and POSIX-style paths, and the path delimiter can be either a forward slash or a backslash. UNC path names are also supported. (In a network, a UNC is a way to determine the location of a file, which users can use without caring about the physical location of the storage device.) This specification has been used in the Windows operating system, Novell NetWare, and other operating systems to replace the local naming system. In a UNC, we don't care about what disk (or volume) the file is on, or where the server where the disk (or volume) is located. We can access the file only in the following format:
\ \ server name \ share name \ path \ filename
The share name is sometimes referred to as the logical identity of the volume or storage device where the file resides, but it is used so that users do not have to care about the physical location of the volumes or storage devices. )
A POSIX-compliant operating system, such as Linux, does not have the concept of a disk character. All absolute paths start with a slash, not a letter (such as C:). All file systems are subdirectories. For example, two hard drives, one of which is the root, and the other may be under the/disk2 path.
Because programs on many UNIX systems assume a single POSIX file system structure, Cygwin maintains an internal POSIX view of the Win32 file system so that these programs can run correctly under Windows. Where necessary, Cygwin uses this mapping to convert between Win32 and POSIX paths.
4.1.2 Cygwin Mount table
The Mount program in Cygwin is used to map the Win32 letter and network share paths to the internal POSIX directory tree of Cygwin. This is a concept similar to the typical UNIX mount program. For people who are unfamiliar with UNIX and have a Windows background, the Mount program is very similar to an early DOS command join, which is to take a letter as a subdirectory of another path.
The path mapping information is stored in the current user's Cygwin mount table, which is also in the Windows registry. This way, the information is removed from the registry the next time the user logs in. The Mount table is divided into two categories, with the exception of each user-specific table and the system-wide Mount table, where each Cygwin user's installation table inherits from the system table. System tables can only be modified by a user with the appropriate permissions (Windows NT administrator).
The current user's Mount table can be seen under the registry "Hkey_current_user/software/red Hat, Inc./cygwin/mounts v". system tables
exists under HKEY_LOCAL_MACHINE.
The POSIX root path/default points to the system partition, but you can use the Mount command to point back to any path in the Windows file system. Cygwin always use the longest prefix in the Mount table when generating a POSIX path from the Win32 path. For example, if C: Is installed in both/C and/,cygwin will convert C:/foo/bar to/c/foo/bar.
If you invoke the Mount command without any parameters, the Cygwin current installation point collection is listed. In the following example, the C disk is the POSIX root and the D disk is mapped to//. In this case, the root is a system-wide installation point that is visible to all users, and/d is visible only to the current user.
c:\> Mount
F:\cygwin\bin On/usr/bin type System (Binmode)
F:\cygwin\lib on/usr/lib type System (Binmode)
F:\cygwin On/type System (Binmode)
E:\SRC on/usr/src type System (Binmode)
C:ON/CYGDRIVE/C type User (Binmode,noumount)
e:on/cygdrive/e type User (Binmode,noumount)
You can also use the Mount command to add new installation points and remove installation points with Umount.
When Cygwin cannot convert a Win32 path to a POSIX path based on an existing installation point, Cygwin automatically converts it to an installation point that is under the default POSIX path/cygdrive. For example, if Cygwin accesses Z:\foo and the Z disk is not currently in the Setup table, then z:\ is automatically converted to/cygdrive/z.
You can assign special properties to each installation point. Automatically installed partitions appear as "Auto" installations. The installation point also has the option of "TextMode" or "Binmode", which determines whether text files and binaries are handled the same way.
4.1.3 Other path-related information
The Cygpath tool provides the ability to convert win32-posix path formats in a shell script.
Home, path, and Ld_library_path environment variables are automatically converted from WIN32 format to POSIX format when the Cygwin process is started (for example, if there is an installation from the Win32 path to the POSIX path, the C:\ Cygwin\bin to/bin).
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.