Gary Matthew Rogers

November 30, 2005

Linux commands in Windows

Filed under: Linux — Administrator @ 1:39 am

I am constantly finding myself using the Windows Command Prompt and accidentally entering commands such as:


C:\Documents and Settings\Administrator>ls
'ls' is not recognized as an internal or external command,
operable program or batch file.

So I went on a quest to see if there was an easy way to use POSIX (Portable Operating System based on Unix) commands in the Windows Command Prompt.

The answer… Cygwin!!

Cygwin is about the niftiest thing since sliced bread. In a nutshell, it is a collection of a buch of common GNU posix applications ported and compiled to run on Windows. And best of all, it is a sinch to install.

Steps to install Cygwin:

  1. Download and run the installer
  2. Select Download Source

    step 1

  3. Select Root Install Directory

    step 2

  4. Select Local Package Directory

    step 3

  5. Select Connection & Download Mirror
  6. Select Packages (Toggle the View to “Full”). Be sure to go over the list and add any extra packages you would like to download.

    step 4
    The installer will then download and install your selected packages.

Steps to make Cygwin commands available in the Windows Command Prompt:

  1. Hold ALT and Double-Click “My Computer” and select the “Advanced” tab

    properties

  2. Click the “Environment Variables” button
  3. Under the “System variables” section, double-click on the variable “Path”

    sysvars

  4. Then, simply add ;c:\cygwin\bin to the end of the variable section of the pop-up.
  5. You can then safely “Ok” out of all the open windows.
  6. Restart your computer. A reboot is required for the path variable changes to take effect.

Once rebooted, you can then issue your chosen linux commands in the Windows Command Prompt:

C:\Documents and Settings\Administrator>ls -la
total 518
drwxrwx---+ 14 Administrators SYSTEM      0 Nov 29 23:21 .
drwxrwxr-x+  8 Administrators SYSTEM      0 Nov 27 12:29 ..
dr-x------+  6 ????????       None        0 Nov 27 16:33 Application Data
drwx------+  2 ????????       None        0 Nov  8 13:21 Cookies
drwx------+  2 ????????       None        0 Nov 29 23:38 Desktop
dr-x------+  3 ????????       None        0 Nov 27 12:29 Favorites
drwx------+  6 ????????       None        0 Nov  8 06:07 Local Settings
dr-x------+  2 ????????       None        0 Nov 27 12:29 My Documents
-rwx------+  1 ????????       None   524288 Nov 29 23:38 NTUSER.DAT
	

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress