“ls” alias in Windows

It’s such a small hack, but I’m not a Windows guy, and I get caught out multiple times a day typing ls instead of dir to view files in the working directory when using cmd.exe.

This is already available for PowerShell, but just a simple hack to get around this for the Windows Command Prompt.

  1. Create a batch file called “ls.bat”
  2. In the batch file, simply put “dir”
  3. Add this file to a location in your PATH




 Volume in drive C is Windows
 Volume Serial Number is 0413-1979

Directory of C:\Users\jonathan.els\Scripts

16 May 2018 11:44 PM <DIR> .
16 May 2018 11:44 PM <DIR> ..
16 May 2018 11:41 PM 5 ls.bat
 1 File(s) 5 bytes
 2 Dir(s) 129 793 744 896 bytes free


2 thoughts on ““ls” alias in Windows

  1. Guess I’m not the only one after all. This is fantastic! I’ll share a similar tip. I’m sure there’s a cygwin grep and plenty of 3rd party grep-like apps out there, but for what I typically have to use cmd for is what you wrote about above and to do an ipconfig /all but grep’ing just the ipv4 addresses and/or macs. You can use findstr for that as in ipconfig /all | findstr “IPv4”. Of course there are a bunch of other flags, but the goal isn’t to make myself at home with windows, just to make do.

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.