Coder Perfect

In Linux, how do I recursively find all *.js files in a directory? [closed]


How can I recursively discover all *.js files in a directory under Linux? The result should be a whole path (for example, /pub/home/user1/folder/jses/file.js).

This solution was successful for me:

find $PWD -name '*.js' > out.txt

It searches for all *.js files, outputs the absolute path, and saves the results to out.txt.

Asked by Dmitry Belaventsev

Solution #1

/abs/path/ find -name ‘*.js’

Edit: As Brian points out, if you only want plain files and not directories, links, or other things, add -type f.

Answered by e.dan

Solution #2

On the command line, type find:

find /my/directory -name '*.js'

Answered by Sjoerd

Solution #3

If you only want the list, post a question at

The answer is: cd / && find -name *.js

You must provide the language if you want to implement this.

Answered by Šimon Tóth

Post is based on