How to use the option equivalent to the 'ls' command in Windows

The 'ls' command (note LS, not IS) is one of the first terminal commands veterans teach to Linux beginners.

Linux has a very powerful and valuable command line terminal that is used and loved by users. So, if you've used Linux's Command Line Interface (CLI) before and just recently started using Windows' Command Prompt, you'll feel overwhelmed by the lack of familiar features.

There are many commands supported on the Linux terminal that do not exist on Windows 10 and 11. Fortunately, the 'ls' command is a supported command on the Windows Command Prompt. Read on to discover how to use the "ls" command in Windows 10 and 11!

What is the 'ls' command?

The 'ls' command (note LS, not IS) is one of the first terminal commands that "veterans" teach newcomers to Linux. It allows users to list files and directories from CLI. You can think of it as a File Explorer, but without the user-friendly icons and navigation buttons. By using the 'ls' command, a Linux user can list the contents of the current working directory.

How to use the 'ls' command in Windows Command Prompt

Windows is a completely different ecosystem when compared to Linux. As a result, many Linux CLI commands are not supported by the Windows Command Prompt tool. If you try to use the 'ls' command in the Command Prompt, you will get the following error 'ls is not recognized as an internal or external command, operable program or batch file' . internal or external, operable program or batch file).

However, you can use the 'ls' command function in Windows with the equivalent dir command in the Command Prompt.

 

How to use the option equivalent to the 'ls' command in Windows Picture 1How to use the option equivalent to the 'ls' command in Windows Picture 1

To list files and folders using Command Prompt in Windows 10 and 11:

1. Click the Start menu icon, search for Command Prompt, right click on Best Match and select Run as administrator .

2. Once the Command Prompt window is open, navigate to the folder you want to view and enter dir.

3. Command Prompt will now list all files in the current working directory, along with their size and last modified date.

How to use the "ls" command in Windows PowerShell

Although the "ls" command does not work on Windows Command Prompt, it does work in Windows PowerShell. Windows PowerShell is a very powerful utility and even allows you to perform complex file management tasks such as creating, deleting, copying files and folders straight through the terminal.

PowerShell's Get-ChildItem cmdlet allows users to easily list file directories using any alias, such as ls, dir, and even gci.

How to use the option equivalent to the 'ls' command in Windows Picture 2How to use the option equivalent to the 'ls' command in Windows Picture 2

 

To view the file directory with the "ls" command in Windows PowerShell:

1. Launch Windows PowerShell using the Start menu and select Best match.

2. Navigate to your destination directory with the cd command.

3. Type ls command and press Enter to see all the files and folders listed in your target directory.

4. Similarly, you can even use the dir or gci command to view the contents of a directory.

4.3 ★ | 7 Vote