views:

1395

answers:

13

when i have to use MSwindows i always open a cygwin window so would like to know whats your favourite commands when using cygwin ?

some of mine are :

tail -c anylog   //to wathc logs file continuously
locate somefile  //find file
alias longCommand ='tail -c anylog |grep --color "term1\|term2\|term3"'
cat *.txt        //print all content of every txt file in directory
mv p2p/*.mp3 myDocs/myMusic // :D self explanatory
+1  A: 

I find that it behaves better when I SSH into my own machine rather than use the cygwin console.

Terhorst
You might want to look at http://code.google.com/p/puttycyg/ or http://www.9bis.net/kitty/ which have cygwin terminal in putty built in.
Douglas Leeder
A: 

They're pretty much the same old timeless Unix shell-scripting hacks.

A: 

Try this trick for fun:

Open up two consoles. Use tty in one. It will give, for example, /dev/tty0.

In the other console do:

echo "Message" >> /dev/tty0
Terhorst
+7  A: 
$ sort < .bash_history | awk '{print $1}' | uniq -c | sort -r
    108 ls
     79 cd
     44 java
     38 vi
     28 wc
     28 /c/Program\           # whoops!
     23 rm
     18 jar
     17 ipconfig
     12 cut
     12 cp
      9 mv
      7 mkdir
      5 exit
      5 diff
      4 sort
      4 javac
      4 cat
      2 tracert
      1 pwd
jon
My top three: exit, ./mplayer.exe, grep
Terhorst
+1  A: 

i forgot :

cat *.avi >> big_file.avi
wget http://someurl/file
nano myfile
nmap 192.168.1.* |grep --color open
+2  A: 

First, install rxvt.

Then set up a shortcut for rxvt. I like tcsh, so my shortcut looks like: Target: C:\cygwin\bin\rxvt.exe -e /bin/tcsh.exe Start in: C:\cygwin\home\me

Then add windows paths to your shell: setenv PATH /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/home/shuffman/bin:/cygdrive/c/WINDOWS/system32

Now you can use cygwin in place of most windows commands; ipconfig, etc...

+1  A: 
Gustavo Carreno
A: 

The best use for cygwin is that I don't have t put up with windows at work (except for email and a few company-specific applications)

dsm
A: 

Best way to run cygwin is in wine on a linux system, solely for the irony factor.

Rich Bradshaw
A: 

I use cygwin's X-server for X11 forwarding over SSH. And for command line svn.

Stefan Schweizer
+3  A: 

I use it for as much as possible, including navigating my source tree. Thus I have an alias, mirroring the OS X open command:

alias open=cygstart

Eg. open . opens the current directory in explorer and open README.txt launches Notepad++.

And I have a small script so that I can use tortoiseSVN from the command line, which I find invaluable. Bringing the best of both worlds together.

#!/bin/sh
# Use TortoiseSVN from the cli
# Public Domain, Max Howell 2008

path=$2
test -z $path && path=.
test -e $path && path=`cygpath -wa $path`

svn='/cygdrive/c/progra~1/TortoiseSVN/bin/TortoiseProc.exe'

function svn
{
    "$svn" /notempfile /command:"$1" /path:"$path" &
}

case $1 in
    up | update) svn update;;
    ci | commit) svn commit;;
    log) svn log;;
    props) svn properties;;
    browse) svn repobrowser;;
    *) /usr/bin/svn $@;;
esac

Now svn ci opens up the Tortoise commit dialog, which is the best I've found on any platform. svn log opens the pretty good, but very useful Tortoise log dialog. Et cetera.

I maintain the script here: http://www.methylblue.com/blog/using-tortoisesvn-from-the-command-line/

Max Howell
+1  A: 

See this existing stackoverflow question.

Adam Mitz
A: 

I use cygwin with the screen command to keep all my work in one command window rather then three or four windows. I also do any console c/c++ programming under cygwin with gcc, use the ssh client included, compile any unix based software I want to use such as remind, and use the version of perl included with cygwin for system administration stuff.

Jared