How to open a window from terminal in cygwin on vista

So I got a new Dell through work with Vista installed. Naturally one of the first things I did was install cygwin so I can use mintty. This gives me a decent terminal on widnows. If you don’t know what those are, I encourage you to give them a shot.

Anyway, having used a mac forever, I found myself missing the ‘open’ command that you can do from Terminal (on the mac) to pop open a window from the directory you are in.

With a quick search, I found that someone else already figured this out, so I am going to post my version of it here:

In your .bash_profile, add this:

alias open="cygstart \$1"

Then in mintty (or any cygwin terminal) you can cd to where ever you want, then just do ‘open [path]‘ and it will pop open a windows window for [path].

Examples:

  • open current directory: $ open .
  • open home directory : $ open ~
  • open program files: $ open ~/c/Program\ Files

Note: that last one assumes you have made a symlink in your home to /cygdrive/c/

$ cd ~; ln -s /cygdrive/c

Here is the original thread that I found this tip in:
http://cygwin.com/ml/cygwin/2002-09/msg00632.html

There are a few solutions posted, my favorite is:
http://cygwin.com/ml/cygwin/2002-09/msg00635.html

1 comment to How to open a window from terminal in cygwin on vista

  • Good tip.

    Another quick way to open a file, directory or URL in mintty is to hold Ctrl and left-click on its name. Alternatively, select it and choose ‘Open’ from the context menu.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">