Cmder: 'ls' is no longer recognized command

Created on 8 Dec 2015  路  12Comments  路  Source: cmderdev/cmder

I'm using cmder version of cmd.exe and command ls used to work fine. I don't know what changed, but it's no longer recognized.

C:\Users\Dana
位 ls
'ls' is not recognized as an internal or external command,
operable program or batch file.

Does anyone know the solution to this problem?

Most helpful comment

There are a couple things you should investigate:

What is currently on your cmder shell path? Use set PATH to see the semicolon-delimited list of path entries. Presumably there are entries there for cmder and some of its subdirectories.

Have you installed some version of Git outside of cmder?

Does your cmder installation include git as it should? I've installed v.1.2.9 of cmder, is that what you have or do you have something older? In my case git is installed here:

cmder/vendor/git-for-windows 

and the ls executable is

cmder/vendor/git-for-windows/usr/bin/ls.exe

Either something is wrong with your installation and you are missing those directories/files, or you have them but your PATH does not include the directory for some reason. If you do have the files you can try adding the directory containing ls.exe to your path from the shell, e.g.

set PATH=C:\cmder\vendor\git-for-windows\usr\bin;%PATH%

Then try ls and see if it works. If so, you can copy that same line to your cmder/config/user-startup.cmd file to make the change permanent. (If you're on an older version of cmder you may not have the file and would have to put this somewhere else).

All 12 comments

The error indicates that ls is not on your PATH. Cmder includes an ls executable as part of the git distribution, which is added to the PATH by the default cmder\vendor\init.bat script.

From my shell I can see that ls is on the path:

位 where ls
C:\opt\cmder\vendor\git-for-windows\usr\bin\ls.exe  

@glucas How do I add ls to my PATH?

Have you tried installing the full version of cmder?

@MartiUK I installed full version of cmder and it worked fine till few days ago and I have no idea what happened, it just stopped working on it own.

There are a couple things you should investigate:

What is currently on your cmder shell path? Use set PATH to see the semicolon-delimited list of path entries. Presumably there are entries there for cmder and some of its subdirectories.

Have you installed some version of Git outside of cmder?

Does your cmder installation include git as it should? I've installed v.1.2.9 of cmder, is that what you have or do you have something older? In my case git is installed here:

cmder/vendor/git-for-windows 

and the ls executable is

cmder/vendor/git-for-windows/usr/bin/ls.exe

Either something is wrong with your installation and you are missing those directories/files, or you have them but your PATH does not include the directory for some reason. If you do have the files you can try adding the directory containing ls.exe to your path from the shell, e.g.

set PATH=C:\cmder\vendor\git-for-windows\usr\bin;%PATH%

Then try ls and see if it works. If so, you can copy that same line to your cmder/config/user-startup.cmd file to make the change permanent. (If you're on an older version of cmder you may not have the file and would have to put this somewhere else).

I know this is old, but thought this might just be relevant to someone...

@dmxt not sure if it's the same root, but I had exactly this symptom on a brand new full version install of cmder and I eventually realised (thanks to @glucas's pointers above) that it was going wrong for me because my version of Git for Windows was fairly old and it seems to have had no /usr directory.

Thus when cmder was identifying that I already had Git and adding to my PATH for that (see init.bat within cmder\vendor** ) it tried to look in *\Git\usr\bin* for **ls.exe and failed to find it (as there was no such directory).

Rather than edit init.bat (_and face it going wrong when I subsequently update cmder_) I simply installed the newest version of Git for Windows and on re-opening cmder all was fine :smile:

@nmstoker Thank you! With your comment, it took me 2 minutes to solve this issue!

Hi
I need help to resolve this problem .Spent 7 hrs without any lucky

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Hi
I need help to resolve this problem .Spent 7 hrs without any lucky

'C:\Program' is not recognized as an internal or external command,
operable program or batch file

@nyangeta sorry, but you haven't given enough detail for anyone to work out your problem (even though I've a few guesses) As this may well be a completely separate cause from this issue, I'd suggest checking existing issues and possibly raise a new issue if you still draw a blank on here and Stackoverflow. Good luck!

ls issue
ls issue 2
Every time I try to use the command ls (I have two ls.exe in my computer, how can i choose the right one )

The 'where' command is showing you the results in the order they are in your PATH. So the ls.exe you don't want is being found first in your PATH.

It seems like you have Z:\ as an entry in your PATH ahead of git. You could find where that is coming from and remove it, or you can add some commands to your cmder user_profile.cmd to make sure the git bin dir is added to the front of your PATH.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Joe1992w picture Joe1992w  路  3Comments

brunowego picture brunowego  路  3Comments

GlassGruber picture GlassGruber  路  3Comments

zsedcbm picture zsedcbm  路  3Comments

jenisys picture jenisys  路  3Comments