简体   繁体   中英

Find all files with an extension and view them

I want to find all files having a same extension and view content of those found files. ex: Find all js files in /home/user/Desktop/test and view the content of that files in linux terminal .

If you only care about the contents of a single directory you can use the command ls /home/user/Desktop/test *.js | cat ls /home/user/Desktop/test *.js | cat . If you need to recursively you can use the command find /home/user/Desktop/test -name *.js | cat find /home/user/Desktop/test -name *.js | cat

find . -name *.js -exec cat {} \\; in test directory

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM