HOME     OBJECTIVE     UNINSTALL     INSTALL     INSTALL (CD)     SPEARFISH     BASH     READY?    
NOTES     QUESTIONS     LINKS     TO DO     FEEDBACK     PROBLEMS     SESSIONS: 01   02   03

Session 03: Cygwin commands

  1. All the "how-to-do-it" instructions on this webpage presuppose that you have done all the things described in Starting Point: Installed, and you are in compliance with the way things are supposed to look.

  2. We now have WinGRASS (with suitable sample data) all installed on our computers and we are now ready take it around the block. My startup screens look like this: :

    desktop
    CLICK TO ENLARGE

  3. The Cygwin Users manual may be found online here or on your own computer here (html).

  4. We are primarily concerned with Chapter 3, found online here or on your computer here (html).

  5. Most of the Cygwin utilities are not really intended to operate from the command prompt, and some of them could produce some very undesirable results. I found some files and directories relocated after playing around with some of these utilities that are not really intended to be operated from the Bash command prompt. We will only be using those which put output to the screen in order to see how Cygwin utilities operate in the Bash environment. For the others, it won't hurt us to know they exist.

  6. Cygwin utilities found to work in the Bash window include:
    • cygcheck. In the Bash window, I entered
      cygcheck
      and got a list of available options.
      I entered
      cygcheck -s -v -r -h > cygcheck_output.txt
      and received a voluminous report recommended for providng data to others for trouble-shooting. Note that the output uses ">" to redirect the output to a text file (saved in the /home/[username] directory).

      The output file was completely readable in Notepad, and would be expected to print normally from my Windows inkjet printer. This is not unexpected since Cygwin is primarily a Windows program. It probably could have been redirected to a printer using "> prn". Redirecting to my Windows printer does not work satisfactorily when used with Linux/UNIX commands which are not Windows programs. I would expect that if the output from the Linux/UNIX commands were redirected to a file (redirection using ">" does work with them) that the file would be printable (possibly requiring conversion from UNIX file format to Windows file format using some utility). We have seen that the Bash shell accepts three kinds of commands, operating in one of two different ways:

      • GRASS commands, which were created to operate in a Linux/UNIX environment
      • Linux/UNIX commands, which were created to operate in a Linux/UNIX environment
      • Cygwin commands, which can executed in a Linux/UNIX environment (of its own making!) by a program created to run in Windows.
      Interesting!

    • ps. At the Bash command prompt, I entered:
      ps
      and got this display in the Bash window:
       GRASS 6.0.0 (spearfish57):~ > ps
            PID    PPID    PGID     WINPID  TTY  UID    STIME COMMAND
           3336       1    3336       3336  con 1003 05:36:36 /usr/X11R6/bin/XWin
           2948       1    2948       2948  con 1003 06:38:58 /usr/bin/xterm
           3240    2948    3240       3280    0 1003 06:39:02 /usr/bin/sh
           3904    3240    3240       3276    0 1003 06:39:06 /usr/local/bin/wish8.4
           2212    3240    2212       2924    0 1003 06:39:07 /usr/bin/bash
           2284    2212    2284       2392    0 1003 06:39:16 /usr/bin/ps
      GRASS 6.0.0 (spearfish57):~ > 
      
      At the Bash command prompt, I entered:
      ps > prn
      and while it was sent to my Windows inkjet printer, I only got the first line of text (after I did a manual formfeed), and the rest was lost, due to the printer not being able to handle linefeeds in the UNIX file format it received. That surprised me.

      At the Bash command prompt, I entered:
      ps > psdump.txt
      so that it would output to a text file which I now know will be in /home/[username]/ directory. I opened the file in Notepad and while it was received, Notepad was dumbfounded at tab spacing and line endings. I opened it in my smarter-than-the-average-text-editor UltraEdit, and found that the above formatting was retained and printed normally. I opened the file in Wordpad, and it also was not dumbfounded by the UNIX file format. Wordpad required reducing the side margins in Page Setup to avoid wrapping within a line of text (as would UltraEdit for very long lines).

      So what have we learned? If we want to print the output of any command entered at the Bash command prompt, we will need to first, redirect it to a text file, and secondly, we will need to open it with something smarter than Notepad in order to print it, but that it can be done.

    • Take a look at the other Cygwin utilities, mostly just to know that they exist. Some of these, e.g, regtools, is potentially disastrous in the hands of the unknowing (that is one you couldn't pay me to use!).
TOP

References

TOP

Comments or suggestions?