Alex and I got some new laptops the other day. I have been a Linux user primarily for many years but the laptop came with Windows 7 so I decided to give it a spin. I must say on the whole I have to say it is a very fast and usable operating system. There is just one thing I was missing and that was Linux shell commands in the terminal. Nothing fancy but I am so used to using ls,rm and grep that I almost went back to Linux. But then Alex mentioned something about adding Cygwin to his laptop which I am of course familiar with but he also mumbled about adding it to the path. I had never even considered this, so I did it and wow is it cool. All the commands I love are in my terminal now. Plus if you use console.exe you can have tabs and every thing.
Ok so on with the article:
First thing you have to do is install Cygwin. I am not going to get into that since it is pretty straight forward however the one thing which is important to note is the install path. the default is C:\cygwin which is what I use however every one does it a different way so I figured I should mention it. Here is a picture of the screen where the install location is defined.
Ok so we got Cygwin installed and working. The next thing we need to do is add the /bin directory of Cygwin to the path variable. This was a little confusing because when you are in the Cywin shell and type “which ls” which should tell you where the ls binary is. What it says is /usr/bin which is where it would be on a Linux/Unix machine but in reality all the binaries for Cygwin are in C:\cygwin\bin assuming you installed to the default location.
So, to add something to the path in Windows we just do this.
- From the desktop, right-click My Computer and click Properties.
- Click on the Advanced System Settings.
- Click the Environment Variables button.
- Finally, in the Environment Variables window highlight the Path variable in the
Systems Variable section and click the Edit button. Add or modify the path lines with the paths you
wish the computer to access. Each different directory is separated with a semicolon as shown below.
Here you can see the exact syntax to add it to the path after you select edit:
In case you cant read it the it should look like this:
C:\cygwin\bin\;
It is really important to seperate commands in the path with a semi colon.
Ok so now to test this out. Open up a windows command prompt and try out a linux command.
Ok so thats pretty cool, looks like ls and less are working. At this point we could be happy and stop but why would we do that when there is another tweak we can make to our windows install to make us Linux users feel more at home.
A few days ago Alex wrote a article here on console.exe which is a really cool little program which enhances the windows shell quite a bit. The most important part for me is tabs which is something I was really used to on my Gentoo laptop. I’m the kinda guy that has 20 tabs going at once. So once you get console installed lets see what we are looking like now:
I Just ran a few simple commands but you get the idea of how nice all these things can work together. Its little things like this that can make the difference in what operating system I use. For now though I am quite happy with Windows 7 and I will be be bringing many more articles as I explore it more.
Worked like a charm!!
Thank you guys..:) :)