All commands have been working until a few days ago on our Ubuntu server. When running ls or cd it returns bash: /bin/ls: No such file or directory.

How can this be fixed?

  • ls is a binary so a faulty PATH environment could be to blame as many folks have suggested. However, cd is also a shell builtin, which should be working. Does it report exactly the same error? – Kyle Smith Jan 28 '12 at 23:22

It seems like the ls executable is missing. ls is part of the coreutils package on Debian-based systems, so you might want to see if it's been uninstalled.

You can use aptitude:

runejuhl@lapaz:~$ aptitude search ^coreutils$
i coreutils                      - GNU core utilities

In the above, the "i" in the beginning of the line means that the package is indeed installed.

  • ls is installed. – Wombats Jan 28 '12 at 21:28
  • Hmm. What does stat -c '%A %n' /bin/ls tell you? It should be something like this: -rwxr-xr-x /bin/ls – runejuhl Jan 28 '12 at 22:00

Surprisingly, the same message would be generated in this situation: /bin/ls binary is replaced with a shell script, but this shell script has an invalid bang line (for example if it starts with #!/this/does/not/exist). Hmmm, rootkit?


Check your /etc/environment file to make sure it still specifies the path. The default Ubuntu (as of 9.10) has just one line in it:


That one line gets pulled into various sub-systems that handle login however. Setting the PATH elsewhere can mess Ubuntu's GDM up.

  • It still shows the path. – Wombats Jan 28 '12 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.