Monday 6 April 2009

Unix ls and ls -l for Windows

Linux Logo

I spend almost all my time in some form of Unix when I work on computers. So when I have to work on Windows, I am constantly typing ls to get a directory list and ll which is my alias for ls -l. Instead of trying to retrain my brain to use dir again, I do the following to the Windows system I am working on.



  1. cd \windows

  2. edit ls.bat

  3. Put the following into the file: dir /w %1 %2 %3 %4
    This makes the dir command ouput more like ls. The parameters (%1 %2, etc...) allow you to add parameters, file wild cards, and such to the command line.

  4. Save the file and close it.

  5. edit ll.bat

  6. Put the following code in the file: dir %1 %2 %3 %4
    The default behavior of dir is like ls -l.

  7. Close and save the file.


That is it. Now you have ls and ll in Windows. No retraining required.

No comments:

Post a Comment