Linux Tools On Windows–The Official Windows Version
Microsoft has long recognized the value of Linux and Unix–Microsoft was even planning to replace Windows with its own version of Unix, called Xenix, back in the late 1980s. Alas, Microsoft signed a deal with IBM to develop OS/2, parts of which evolved into Windows NT and the current versions of Windows.After stopping support on Xenix, Microsoft produced an official package called Windows Services for Unix. For Windows Vista and Windows 7, the package was renamed Subsystem for Unix-based Applications (SUA). It includes over 350 Unix applications, plus libraries that allow Windows to talk to Unix.
Unfortunately, two things prevent us from recommending you install SUA today. First, it requires either the Enterprise or Ultimate editions of Windows, so most users can’t use it. Second, many of the Linux utilities it includes are years out of date, depriving users of some of the best features.
Linux Tools on Windows Using Cygwin
Begun in 1995, Cygwin is by far the most popular way to run Linux tools on Windows. Contributing to its popularity is the fact that it’s free and it supports a dizzying array of Linux tools–a full installation of Linux tools can take up over 4 GB of disk space, although you don’t need that much to get started.The great thing about Cygwin is that it makes all of its tools available to the regular Windows command line, yet if you choose to use one of the Linux command lines, you can still use all of the Windows tools. This means there’s no trade off–you get powerful Linux tools without giving up anything (except a bit of disk space).
Installing Linux Tools on Windows
Installing Cygwin is a breeze. Go to cygwin.com, click the Install Cygwin link, and download and run setup.exe. Cygwin will open a window that lets you choose what you want to install–by default only a minimal set of Linux tools are installed.After choosing which programs you want to install, Cygwin’s setup.exe will automatically download all the necessary files. This step may take a while, particularly if you have a slow Internet connection or you selected a lot of packages. After downloading all the files, Cygwin will install them and offer to create an icon for you on your desktop and Start menu to launch the Bash shell. I highly suggest you accept, for you can use copies of this launcher to create your own launchers to your favorite Linux tools.
After installation, Cygwin runs a few post-installation scripts. Sometimes these scripts pop up windows which disappear after a moment. Don’t be alarmed–this is a quirk in Windows and you won’t see it again until you upgrade Cygwin.
Using Linux Tools On Windows
After your installation finishes, I suggest you dive right in to Cygwin. Double-click the Bash Shell icon on your desktop, which will open the default Windows terminal and the Linux Bash shell.A shell, in Linux jargon, is a program which loads other programs. It can also be used to create shell scripts, which are very similar to Windows batch files. Linux shells almost always end with the letters sh (for SHell); there are a number of other shells you can choose from in Cygwin, but Bash is the best for learning about Linux.
After launching Bash, you may discover that it uses different filenames than what you expect. In Windows, all full filenames start with a drive prefix, for example
C:Program Files
. In Cygwin applications, all full filenames
start with a single forward slash, /
. Unfortunately this means
filenames are different in Cygwin and Windows; here’s how to find your files no
matter where you are:- In Windows all of your Cygwin files are in the
C:cygwin
folder. Most files will be in your Cygwin user directory, which isC:cygwinhome*username*
(where username is your Windows username). - In Cygwin all of your Windows drives can be found in the
/cygdrive
folder. Files in your Documents folder will be in/cygdrive/c/Users/*username*/Documents
ls
. You can change directory by typing cd
followed by
the directory name you want to move visit. These are the same commands you would
type in a Windows command line.Learning To Use Linux Tools on Windows
Hundreds, maybe thousands, of books have been written about learning Linux, so I don’t expect to teach you everything you want to know about using Linux tools on Windows in this one article. But I can leave you with a few hints on how to find more information:- Most Linux programs come with a manual page. You can read the manual page by
typing
man
before the name of the program. For example, try runningman bash
right now. - Try doing in Bash anything you would usually do on the Windows command line. In most cases, Windows and Linux use programs with the same names, so switching is easy.
No comments:
Post a Comment