Dir vs ls
If you use linux or Mac OS terminals a lot you’ll be used to typing ls to get a directory listing. For me, it is so deeply seated in physical memory that when my brain thinks “I need a directory listing”, my hands type ls.
On Windows machines, the equivalent command is dir. This is always the second command I type at a Windows command prompt, having failed to beat my hands and intercept the ls that is already trotting from my fingers. Today I got fed up with it. Here’s the solution I devised:
- Open a new text file, type: dir
- Save as ls.bat in C:WindowsSystem32
Now every time you type ls at a Windows command prompt it will resolve to this batch file. The batch file contains a single command:- dir.
Whilst I’m on the subject of Windows command prompt tips (who’d‘ve thought it?!), I also discovered today that (again, like Mac OS and linux) when typing file and folder names you can type the first few letters of the file name and hit tab to autocomplete. You have to type enough letters to make the sequence unique, but that’s not usually very many. For example, from the root of my C drive:
C:> cd doc[tab][enter]
C:Documents and Settings>
Isn’t that handy? Don’t say I never give you anything.