How can I find all *.js file in directory recursively in Linux?

LinuxFind

Linux Problem Overview


In Linux, how can I find all *.js files in a directory recursively? The output should be an absolute path (like /pub/home/user1/folder/jses/file.js)

this answer worked for me:

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

It finds all *.js files, output absolute path, writes the results into out.txt.

Linux Solutions


Solution 1 - Linux

find /abs/path/ -name '*.js'

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

Solution 2 - Linux

Use find on the command line:

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

Solution 3 - Linux

If you just want the list, then you should ask here: http://unix.stackexchange.com

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

If you want to implement this, you have to specify the language.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDmitry BelaventsevView Question on Stackoverflow
Solution 1 - Linuxe.danView Answer on Stackoverflow
Solution 2 - LinuxSjoerdView Answer on Stackoverflow
Solution 3 - LinuxŠimon TóthView Answer on Stackoverflow