Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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

3 Answers 3

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.

share|improve this answer
    
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?

share|improve this answer

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:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

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

share|improve this answer
    
It still shows the path. –  Wombats Jan 28 '12 at 21:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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