Thursday, April 9, 2009

Cygwin ls command not found

If you are a linux enthusiast and really miss those greps and sed/awks on the windows box, you've probably installed cygwin. You tried running it either by double-clicking the cygwin icon on your desktop or the cygwin.bat file in your "C:\cygwin" directory and got the bash-3.X$ prompt. However, although the pwd or cd commands work, if you try ls, it says:"ls: command not found".

Here is what you need to do to fix it:
  1. Right click on "My Computer" -> Properties -> Advanced -> Environment Variables
  2. Add a new environment variable, called CYGWIN_HOME and set its value to C:\cygwin
  3. Edit the PATH environment variable and add C:\cygwin\bin to it (usually separated by a ';').
  4. Just click okay, exit any command prompts or bash shells (over cygwin) you may have open, and open it again - it'll work!
Note: this assumes that you have installed cygwin at C:\cygwin. If you've kept it someplace else, please modify the above accordingly.

44 comments:

  1. Thanks, roger! Our first comment on the blog! :)

    ReplyDelete
    Replies
    1. Hi There !! My Cygwin still doesn't work....
      I am trying to use glx rendering
      i write this

      User@User-PC /cygdrive/d
      $ glxinfo | grep render
      and output is this
      bash: glxinfo: command not found
      NOTE : i am new to unix and cygwin/..Just need help

      Delete
  2. thanks sudipta! this was very helpful

    ReplyDelete
  3. Thank you so much. That is very help.

    ReplyDelete
  4. Thanks a lot! I spent so much time downloading
    Cygwin in order to learn Linux console
    commands - and it didn't know even about ls!

    I've translated your tip into Russian and
    posted to my blog. Hope, you don't mind

    ReplyDelete
  5. is it work when cygwin installation is not completed because i need ls command for installation purpose??
    there is no files in my bin folder .what should i do??

    ReplyDelete
  6. thanks buddy,
    what abt the wget command. it is also not working in my cygwin

    ReplyDelete
  7. hi there!

    But should you unistall the "run" package from Cygwin...

    Even though the Env. variable in Windows reads sequential and if we keep the Cygwin path the last - still may cause prob?


    Cheers!

    ReplyDelete
  8. As a side note, you may also want to add:

    C:\cygwin\usr\sbin to the PATH variable

    ReplyDelete
  9. Worked like a charm.
    Thanks!

    ReplyDelete
  10. For me , it only worked when i added C:\cygwin\usr\sbin also to the path..Thanks Sudipta

    ReplyDelete
  11. Dude, you friggin rock. THANKS.

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. Nice.Easy to deploy and understand.Thanks a lot dude

    ReplyDelete
  14. this is the most helpful thing i've ever found on the internet

    ReplyDelete
  15. It doesn't work for me! and I really wonder why since it seems to work for everybody else who commented!

    ReplyDelete
    Replies
    1. not only for you DUDE but also for me..

      Delete
  16. exactly the info I needed, thank you so much!

    ReplyDelete
  17. bhayio top command bi kam ni kar ri meri to :)

    ReplyDelete
  18. it doesnt work with mine ..i am running win 7 ,,,,any idea how to get ride of it ???? help me plz. my samsung galaxy ace gts 5830 has bricked while flashing,,,not powering on but detects in odin,,?????

    ReplyDelete
  19. Thanks for blogging about useful commands.
    Ls command basically displays the content of directory in sorted alphabetically.
    If you have millions of files/directories, ls command hangs because of sorting.
    Ls –U ouput files without sorting and more useful
    Please see more about Ls command examples in Linux/Unix

    ReplyDelete
  20. Hi There !! My Cygwin still doesn't work....
    I am trying to use glx rendering
    i write this

    User@User-PC /cygdrive/d
    $ glxinfo | grep render
    and output is this
    bash: glxinfo: command not found
    NOTE : i am new to unix and cygwin/..Just need help

    ReplyDelete
  21. oh oh...
    doesn't work
    im on windows 7
    did exactly as you wrote
    :(

    ReplyDelete
  22. hi,
    can we add extra commands to existing command?
    if yes. how?

    ReplyDelete
  23. Thanks. Saved my bacon. Happens every 2 years.

    ReplyDelete
  24. Not working.... Any other proposals ?

    ReplyDelete
  25. It works! thanks for sharing good info.

    ReplyDelete
  26. I am working with cygwin emulator in windows 7 few commands are not working like MAN CAL And few plzz make solution to this problem

    ReplyDelete
  27. I have windows 10 an tried that approach, but it still didn't work.
    whyyyy :(

    ReplyDelete
  28. For those of you using win 10 and the above solution does not work, instead add C:\cygwin64\bin to PATH. it will work.

    ReplyDelete
  29. check PATH in C:\cygwin64\home inside file called .profile

    ReplyDelete
  30. Do you need to increase your credit score?
    Do you intend to upgrade your school grade?
    Do you want to hack your cheating spouse Email, whatsapp, Facebook, instagram or any social network?
    Do you need any information concerning any database.
    Do you need to retrieve deleted files?
    Do you need to clear your criminal records or DMV?
    Do you want to remove any site or link from any blog?
    you should contact this hacker, he is reliable and good at the hack jobs..
    contact : cybergoldenhacker at gmail dot com

    ReplyDelete