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

Kalpit picture Kalpit · Feb 28, 2018 · Viewed 116.4k times · Source

'ls' is not recognized as an internal or external command, operable program or batch file. I get this error when I try to glance at the files of my folder.

  • cmd opened regularly(not as an admin).
  • I've recently downloaded anaconda for python.During the installation process, there was a time when I allowed to add a PATH which was not recommended. 'ls' used to work well be

    Here are the paths

    enter image description here

Answer

Adi219 picture Adi219 · Feb 28, 2018

I'm fairly certain that the ls command is for Linux, not Windows (I'm assuming you're using Windows as you referred to cmd, which is the command line for the Windows OS).

You should use dir instead, which is the Windows equivalent of ls.

Edit (since this post seems to be getting so many views :) ):

You can't use ls on cmd as it's not shipped with Windows, but you can use it on other terminal programs (such as GitBash). Note, ls might work on some FTP servers if the servers are linux based and the FTP is being used from cmd.

dir on Windows is similar to ls. To find out the various options available, just do dir/?.

If you really want to use ls, you could install 3rd party tools to allow you to run unix commands on Windows. Such a program is Microsoft Windows Subsystem for Linux (link to docs).