Command 'ls' not working in command prompt
Asked Answered
P

3

7

Command 'ls' not working in windows Getting an error while executing 'ls'

'ls' is not recognized as an internal or external command, operable program or batch file.

Preferment answered 11/1, 2018 at 6:11 Comment(1)
ls is aliased to dir in Powershell, maybe that's where you've seen it being used?Shadrach
H
15

Use the command dir to list all the directories and files in Windows; ls is a unix command.

Housemother answered 11/1, 2018 at 6:14 Comment(0)
B
3

Please follow below steps to fix this

  1. download and install git https://git-scm.com/downloads.

  2. After git installation is completed,navigate to folder where git is installed. Check in C/Program Files Folder. Navigate to C:\Program Files\Git\bin

  3. Add the above location (C:\Program Files\Git\bin) in path variable in system environment variables.

  4. Restart cmd and try to run ls and other Linux commands.

It should work now!!`

Bestial answered 25/6, 2021 at 6:58 Comment(1)
Git bash is not the only bash emulation tool installable but why notOlecranon
F
0
  • We don't use ls(List) command in windows.
  • Instead of using ls command use dir(Directory) command. This command also displays the total number of files and directories listed.

NOTE:

We can use ls command in Windows PowerShell. It works in PowerShell, shows the files and directories listed.

Ferne answered 12/1, 2023 at 9:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.