How to use the option equivalent to the 'ls' command in Windows
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.
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.
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.
You should read it
May be interested
- 5 Best Practices for Using WSL 2 on Windows 10/11microsoft has introduced nifty features to windows 10 and 11 in recent years, but for the developer community, windows subsystem for linux 2 is probably the standout feature.
- Snipping Tool on Windows 10 and 11 can store data that users have deleted?the snipping tool screen capture tool is one of the most commonly used applications on windows. however, a newly discovered serious problem can completely turn a large part of windows users away from snipping tool.
- How to view recently opened files on Windowsdid you just edit a file, then accidentally closed it and lost track of it? do you want to know what files your computer users have opened recently?
- How to Enable and Use Script Execution Policy in Windows PowerShellby default, script execution on powershell is disabled as a security measure to prevent malicious scripts from running on the system. the following article will show you two ways to enable script execution policy in windows powershell.
- How to use My Favorite Files to create favorite files on Windowsthe my favorite files application is basically like file explorer on windows, managing folders or files on your computer. however, this my favorite files application has a few more interesting features.
- Tiny 10: Ultra-light Windows 10 version for weak PCs, just 2 GB RAM and 16 GB hard drivetiny 10 is the latest minimalist operating system version that has just been announced by ntdev.