Command Line Tricks

Number of Views : 4593

I am a command linke junkie. I have always been, both a linux and windows user and find it is difficult to switch from linux to windows when using the command prompt. In particular, the ls command on linux is similar to the dir command in windows. I found myself always typing ls on a windows machine and getting the “unknown command” return. So to correct this issue there are a few solutions. One is to use cygwin ( a free linux emulator on your windows box. I typically use this when I need to remote console into a remote linux machine w/ X11 running. But for every day use, I tend to use a batch file that emulates the ls command. I will explain how to create a quick batch file to do an ls command.

1. Open a command prompt (go to START | RUN | Cmd) if you are running windows XP or 2000. If you are running windows 9x or me then (go to START | RUN | command)
2. Change directory to your System folder. If you are running Windows XP or 2000 then it will be either c:\winnt or C:\windows. If you are on windows 9x the it will be c:\windows. You change directory by typing “cd c:/windows” or “cd c:/winnt”
3. Create a quick batch file called ls.bat – you do this with the following command:
echo @dir /a /p > ls.bat
Create LS batch file
4. Once you have done this you can then run the the command “ls” and you will see a directory print to screen
Running LS

Leave a Reply

Your email address will not be published. Required fields are marked *