I need to list all the files in the javascript such as \"ls\"??
The short answer is - you should NOT do this as it opens a huge attack vector against your application. Imagine someone running "rm -rf" :).
If you MUST do this and you are 1000% sure you allow only a few commands which cannot cause any harm you can call a server page using Ajax. That page could run the specified command and return response. Again I emphasize this is a huge security risk and should better NOT be done.