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
- Del command in Windows
- Set command in Windows
- Defrag command in Windows
- Xcopy command in Windows
- Command at in Windows
- How to use the command history function in Command Prompt
- 10 useful commands in Windows you should know
- Cmd command in Windows
- The chkntfs command in Windows
- Sub-commands in nslookup Windows command (Part 2)
- Sub-commands in the nslookup Windows command (Part 1)
- The command reg add in Windows
Maybe you are interested
What to do when open command window here does not appear?
How to switch users on the Linux command line
How to fix Mac Homebrew error 'zsh: command not found: brew'
What is the Command key on Windows?
How to use read command in Linux
Basic Linux commands everyone needs to know - Operations on Linux are much faster