Thanks to http://www.voxforge.org/home/docs/cygwin-cheat-sheet
The Cygwin Console (i.e. the Cygwin Bash Shell) is where you will execute all your HTK/Julius commands and scripts, and your VoxForge scripts. It provides a Linux-like environment to execute your commands
Starting Cygwin
Open your Cygwin Console by clicking:
Start>All Programs>Cygwin>Cygwin Bash Shell.
How to change drive in cygwin
In DOS you may have been used to D: to change to the D drive. Cygwin provides a mapping of DOS/Windows drives to the unix file system by mapping or mounting drives into the /cygdrive/ directory. To use the D: drive you would type cd /cygdrive/d.
Alternatively you can use cd d:/
Working with Directories
When you start a Cygwin Console, you are automatically sent to your Cygwin home directory – which usually corresponds to your Windows username. All Windows users on your system should have a home directory with a Windows path of:
c:\cygwin\home\[Windows Username]
To find out what your home directory name is type the ‘pwd’ (i.e. print working directory) command in a newly opened Cygwin Console. In this example my home directory is called ‘Administrator’:
| $pwd /home/Administrator |
Note on Cygwin directories
|
Directory Structure
Cygwin attempts to duplicate the directory structure of a Linux System within the “c:\cygwin” folder:
| Windows location | Cygwin Console |
| c:\cygwin\bin | /bin |
| c:\cygwin\etc | /etc |
| c:\cygwin\home | /home |
| c:\cygwin\home\administrator | /home/administrator |
| c:\cygwin\lib | /lib |
| c:\cygwin\tmp | /tmp |
| c:\cygwin\usr | /usr |
| c:\cygwin\var | /var |
| c:\cygwin | / |
Creating Files
When creating directories and files in your home directory in Cygwin, remember that you can use Windows Explorer to create a file, and Windows Wordpad to edit it (see below for the Cygwin commands to do this). For example, if you need to create a file in the following Cygwin directory:
/home/[your home directory]/voxforge/manual,
then start Windows Explorer, go to this directory
c:\cygwin\home\[your home directory\voxforge\manual
and click ‘File>New>Text Document’ in Windows Explorer to create an empty file. Then use Windows Wordpad to edit it, by doubling-clicking the new file, and selecting WordPad from the ‘Open With …’ selection window.
| Note: If you create a file directly in WordPad, when you save it WordPad will try to append a ‘.txt’ or ‘.rtf’ suffix to your file name. |
Cutting and Pasting Content from Windows to Cygwin
from the Windows application:
- highlight the text to be copied;
- right-click and select copy from right-click menu (or hit ctrl-c key combination);
go to Cygwin window:
- right-click Cygwin window header
- select Edit>Paste from the right-click menu
Extracting Gzipped Tar files in Windows
The 7-Zip program can unzip and untar Linux gzipped tar files from Windows Explorer. Once installed, you simply right-click the file you want to unzip and/or untar in Windows Explorer, and select 7-Zip from the right-click menu. If your file is gzipped and tarred, you need to execute the 7-Zip extract twice: first on the .tgz file, and then again on the generated .tar file.
It is Open Source and licenced under LGPL. It can be obtained at:
You can also use the Cywin tar command (see below)
Common Cygwin commands:
Working with Files
cp <filename> <new filename>
copy – Make a copy of a file
cp -R <directory> <new directory>
Make a copy of a directory
mv <filename> <new filename>
move – Move or rename a file
rm <filename>
remove – Delete a file
Working with Directories
cd <directory>
change directory – Change to the directory specified
ls
List – Lists the files in the current directory
ls -l
Lists the files and their attributes
mkdir <new directory name>
make directory – Create a new directory
pwd
Path of working directory – tells you what directory you are in
Archiving/Extracting Files and Directories
tar -zcvf <filename> <directory> # create gzipped tar archive of <directory>
- -z – filter the archive through gzip
- -c - create a new archive
- -v – verbosely list files processed
- -f – use archive file
tar -xvzf <filename> # extract tarred, gzipped <filename> in current directory
- -x – extract files from an archive
- -v – verbosely list files processed
- -z – filter the archive through gzip
- -f – use archive file
Working with File Permissions:
chmod u+x <filename>
changes permission of the named file to executable.
- u – user, (this means you)
- + - adds permissions
- x – executable rights
You can get further details on any commands in Cygwin by using the ‘info’ or the ‘man’ command. These provide essentially the same information, but with slightly different formatting. To obtain detailed information on the ‘mv’ for example, you would type one of the following:
| $info mv$man mv |
to exit info or man, type the letter ‘q’ at the “:” prompt.