Search
Close this search box.

How to Use Equivalent to ls in Windows

feature image of ls in windows

Are you a Linux fan or making a shift from Linux to Windows? You might be wondering if features like the Is command are also available on Windows OS.

Fortunately, you will find the ls equivalent in Windows. However, not everybody is familiar with it and does not know how to use it. In this article, you will learn how to use the equivalent to ls in Windows.

Key Takeaways:

  • Linux ls command is available on Windows system, but you need to use it with a technique.
  • You can get the list of files and directories in Command Prompt by running the dir command.
  • Ls command works on Windows Powershell after executing the cd command line.

What is the “ls” Command in Windows?

The ls command (LS Command) is a primary Linux function that lets you list the files and directories with their details. It is similar to File Explorer but lacks the user interface (UI) design, including icons and navigation buttons.

When you run the ls command on Windows, you will get the error “‘ls’ is not recognized as an internal or external command, operable program, or batch file.” The “dir” is the Windows ls command.

Method 1) How to Use the “ls” Command in Command Prompt

Cmd returns the files in the directories using the Windows dir command. You can use it to see the hidden files. However, you must modify your prompt and enter this: dir /A:H.

Follow the steps to use the ls Windows alternative:

Step 1) Hit the Windows + R Keys to launch the Run dialogue box. Type cmd and simultaneously press the Ctrl, Shift, and Enter keys to run it as administrator.

run program with cmd command

Step 2) Run the “dir” command.

dir command in command prompt

Once you execute the Windows Command Prompt ls, it will list the files and directories with all the essential information. The details may include date, time, size, and type.

Method 2) How to Use the ls in Windows PowerShell

Unlike Command Prompt, PowerShell directly allows using the ls command in Windows. It is another command line interface that is more powerful than cmd. On PowerShell, you can easily do tricky stuff with files, like making, deleting, and copying them, all from the terminal.

PowerShell has the Get-Childtem cmdlet script that fetches the file directories by running any of these commands: dir, gc, and ls.

Follow the steps to run the ls command in the PowerShell terminal:

Step 1) Search for Windows PowerShell in the Start menu and run it as administrator.

windows powershell in start menu

Step 2) Change the current working directory by running the “cd” command.

cd command in powershell

Step 3) Now enter the “ls” command in the terminal.

ls in powershell terminal

Conclusion

This article teaches you how to use the Linux ls command on a Windows-running computer. Though the Windows operating system offers alternatives to many Linux features, you may find it less powerful than the latter. 

Windows Powershell comes with more advanced functionalities than the command prompt. It even lets you use the ls command line as it is. Explore the resource page for tutorials on more interesting Windows features, such as newfetch.

FAQs

Share on Social Media: 

Leave a Comment

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