CygwinTips
From BluWiki
[edit] Cygwin Tips
[edit] CygWin is...
...a Unix shell and tools for Windows XP (or Win2k, Win98, WinME etc.)
- Cygwin Home Page: http://cygwin.com/
- Install - http://www.cygwin.com/setup.exe
- MIT Cygwin Install page - http://diana.mit.edu/physiotools/cygwin/
- CYGWIN SETUP TIPS: setup asks you to pick a mirror. To see which mirror is near you ...
- setup.exe has some command line options :
[edit] FAQ: How do I just get everything?
- http://cygwin.com/faq/faq.setup.html#faq.setup.everything
- http://cygwin.com/faq/ - The Root of the Cygwin FAQ and it's home
[edit] Don't want everything
To Look-up the package for a missing file you would like to install
- Just mess with the URL : http://cygwin.com/cgi-bin2/package-grep.cgi?grep=file.exe
- OR to use the Search Form : http://cygwin.com/packages/index.html
- package-grep
- Usage: Use perl Regular Expressions to match against filenames
- Examples: to find the package to install tar : tar[.]exe
- Examples: to find the package to install The man page for tar : tar[.][0-9]
- Examples: to find the package to install egrep : /bin/egrep (Tricky because egrep is a soft-link)
- More (implied) Examples : http://www.google.com/search?q=site%3Acygwin%2Ecom+package-grep
- The man page for tar is often missing. Work Around:
- ( x='http://linux.die.net/man/1/tar' ; links -dump "$x" ; echo ; echo "$x" ; ) > /usr/share/man/man1/tar.1
[edit] Where is apt-get for cygwin
- Someday it might be right here: CygGet
- You might want to look at cyg-apt http://lilypond.org/~janneke/software/cyg-apt
[edit] Known Issues
[edit] Lose the DOS-BOX...
[edit] PuTTYCyg
- (I have started using PuTTYcyg more than rxvt)
- PuTTYCyg - Another XTerm workalike. This is a version of Putty capable of running Cygwin bash without sshd OR an X-Server
- puttycyg - http://gecko.gc.maricopa.edu/%7Emedgar/puttycyg/
- Download putty first. Then download and unpack PuTTYCyg into the same folder as your PuTTY executables to get it to work
- Example: Create saved session "PuttyCygwin" with Connection Type of Cygwin and a Short Cut to:
- puttycyg - http://gecko.gc.maricopa.edu/%7Emedgar/puttycyg/
-
"C:\Program Files\PuTTY\putty.exe" -load PuttyCygwin
-
- The Cygwin 1.5 v. 1.7 blues (Works again now)
[edit] rxvt
- http://www.khngai.com/emacs/bash.php
- It Suggests : D:\Programs\Cygwin\bin\rxvt.exe -sl 500 -fn courier -bg wheat -sr -title "Bash Sailor" -e bash --rcfile C:\documents\config\.bashrc
- I Use : C:\cygwin\bin\rxvt.exe -g 124x48 -e /bin/bash
- 20000 Lines of Scroll Back : C:\cygwin\bin\rxvt.exe -sl 20000 -g 124x45 -e /bin/bash
- More Options http://www.nmt.edu/tcc/swinv/rxvt/2.6.PRE1/man/rxvt.1.html
- No X-Server Required, the cygwin rxvt will use MS Windows to fake it if you don't have an X-Server
- Left-Drag will Mark and Copy
- Shift-Insert or Shift-Leftclick or Middleclick (for three button mouse) will Paste (Shift-Insert is old-stile MS Windows key for paste - copying, cutting and pasting text - Ctrl+Insert, Shift+Delete and Shift+Insert)
- If you want Rightclick to also Paste with your two-button mouse (like putty): Download a Windows Mouse Driver that allows Per-Application event-mapping (i.e. mouse-click mapping) and map Rightclick to Shift-Insert for application rxvt.exe. I downloaded the driver for my microsoft wheel mouse from microsoft.com and use the control panel to configure it... it worked great. - http://www.microsoft.com/hardware/mouse/download.asp
[edit] MinTTY - Built into Cygwin
- Just include the package and it will install for you: Shells->MinTTY
- http://lifehacker.com/5185647/mintty-gives-cygwin-a-native-windows-interface
[edit] Cygwin X Window Server
- http://x.cygwin.com/docs/ug/setup-cygwin-x-installing.html
- Make an Windows Shortcut to C:\cygwin\usr\X11R6\bin\startxwin.bat
- Change the Windows Shortcut Icon to C:\cygwin\usr\X11R6\bin\run.exe (2 or 3)
- Startup rxvt / bash and run xhost +111.222.333.444 to add your client box (where you you will run xclock etc.)
- for MUCH more security (and MUCH slower speed) use ssh tunneling with X11 forwarding
- SHORT ssh -X username@111.222.333.444
- Long http://www.jfitz.com/tips/ssh_for_windows.html
- for MUCH more security (and MUCH slower speed) use ssh tunneling with X11 forwarding
- Cygwin Xwindows Server is not very stable on Windows98,ME. Perhaps one of these will be
- http://www.jcraft.com/jdxpc/
- OR
- http://www.tightvnc.com/ - compiled in cygwin as a xwindows server
- http://www.jcraft.com/jdxpc/
[edit] Where can I find lsof for Windows / Win32?
Combine these . . .
- Fport
- Foundstone Fport - http://www.foundstone.com/resources/proddesc/fport.htm - does some of the same things lsof does.
- Will tell which processes is connected to which open TCP/IP port
- for a better picture, combine with MS Windows netstat http://www.ss64.com/nt/netstat.html
- "netstat -abn" will list open sockets and the windows processes-IDs they connect with (on XP and 2003 only, use fport on 2000)
- Sysinternals Handle - http://www.sysinternals.com/utilities/handle.html
- Lists all open file handles for all windows processes
- Sysinternals PSTools - http://www.microsoft.com/technet/sysinternals/utilities/pstools.mspx
- provides ps (pslist) and kill (pskill) for MS Windows processes
- provides ps (psservice) and kill (psservice stop) and more for services
- And provides ... Lots of other goodies
- Sysinternals ListDLLs - http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/ListDlls.mspx
- tasklist / tlist - http://www.ss64.com/nt/tasklist.html
[edit] Where is mail or mailx ?
- Try sendemail a pure perl e-mail sender - http://unix.freshmeat.net/projects/sendemail/
- I have used ssh to a server with mail set up correctly (solves a number of authentication issues, and makes the "From" your remote user.)
- ssh username@hostname.domain.tld "mailx -s 'subject text' recipient@hotmail.com"
- mutt and mutt -x (needs an SMTP agent) http://www.geocities.com/win32mutt/index.html
[edit] sshd - The Secure SHell Deamon
- The CYGWIN environment variable (set it to "binmode ntsec tty")
- in XP this is Start>Settings>Control Panel>System>Advanced>Environment Variables
- http://cygwin.com/cygwin-ug-net/using-cygwinenv.html
- http://www.google.com/search?query
- Old versions of cygwin needed you to create an entry for root in the /etc/passwd
- The Cygwin NT Security page has some examples - http://cygwin.com/cygwin-ug-net/ntsec.html
- Or simply clone the SYSTEM entry in /etc/passwd
- sshd (server side) config files - /etc/hosts.allow /etc/hosts.deny /etc/hosts.equiv /etc/moduli /etc/motd /etc/nologin /etc/primes /etc/shosts.equiv /etc/ssh_host_dsa_key /etc/ssh_host_key /etc/ssh_host_rsa_key /etc/ssh_known_hosts /etc/ssh_known_hosts2 /etc/sshd_config /etc/sshrc
- ssh (client side) debugging - ssh -v -v -v -v -l username hostname
[edit] Cygwin Built-ins...
...make your bash shell a happy place
- http://cygwin.com/cygwin-ug-net/using-utils.html
- cygpath - http://cygwin.com/cygwin-ug-net/using-utils.html#cygpath
- regtool - http://cygwin.com/cygwin-ug-net/using-utils.html#regtool
- cygcheck - http://cygwin.com/cygwin-ug-net/using-utils.html#cygcheck
- mkgroup - http://cygwin.com/cygwin-ug-net/using-utils.html#mkgroup
- mkpasswd - http://cygwin.com/cygwin-ug-net/using-utils.html#mkpasswd
- passwd - http://cygwin.com/cygwin-ug-net/using-utils.html#passwd
- ps - http://cygwin.com/cygwin-ug-net/using-utils.html#ps (Also procps)
- kill - http://cygwin.com/cygwin-ug-net/using-utils.html#kill
- getfacl - http://cygwin.com/cygwin-ug-net/using-utils.html#getfacl
- setfacl - http://cygwin.com/cygwin-ug-net/using-utils.html#setfacl
- mount - http://cygwin.com/cygwin-ug-net/using-utils.html#mount
- umount - http://cygwin.com/cygwin-ug-net/using-utils.html#umount
- dumper - http://cygwin.com/cygwin-ug-net/using-utils.html#dumper
- ssp - http://cygwin.com/cygwin-ug-net/using-utils.html#ssp
- strace - http://cygwin.com/cygwin-ug-net/using-utils.html#strace
[edit] Windows NT and XP...
...have many handy utilities that can be used through the command line
- cmd.exe http://www.ss64.com/nt/cmd.html - DO NOT use command.com if you can help it
- Usage: cmd.exe /c 'cmd-exe-builtin arg1 arg2 arg3'
- Example: cmd.exe /c 'dir' > tmp.txt ; cat tmp.txt | tr -d '\015' | egrep -i 'T$'
- Note: does not work well if current directory is not a local disk (e.g. C:)
- netsh firewall - http://www.google.com/search?q=%22netsh+firewall%22
- Many Many More at http://www.ss64.com/nt
[edit] Cygwin Rosetta Stone
hahaha testing
[edit] Other Handy Cygwin Ports
- Lee Packham's smbclient port (really useful, as cygwin and Windows mounts don't always play nice) http://leenux.org.uk/lpackham/smbclient/
- PuTTYcyg - A Hybryd Cygwin shell and Putty Terminal emulator - PuTTYCyg
- older Cygwin packages
- (Others?)
[edit] Not Cygwin
- Co-Linux - http://www.colinux.org/
- VMWare Player - http://johnbokma.com/mexit/2005/11/07/vmware-player-ubuntu-installation.html
- NirCmd
- PSTools - http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx
- (Old versions before the microsoft takeover http://fly.isti.cnr.it/pub/software/sysinternals/ )
- ActivePerl - http://www.activestate.com/store/activeperl/download
- Cygwin has it's own Perl, but some library modules are only available for ActivePerl
- PowerShell - http://www.ss64.com/ps/






