dcurrie27
dcurrie27

Reputation: 359

How to find a file in a subdirectory and immediately open it - Terminal

trying to make my workflow more efficient. I often have two files of the same name in two directories held within one "master" directory like this:

root

From within terminal I can enter:

find -L . -name "my_website.html" 

and that gives me the list of files and their locations. But I'd like to open them directly from here, rather than navigate down the directories. Is there a way to chain an open command on to open both of the files it finds.

Thanks

Upvotes: 0

Views: 305

Answers (1)

dcurrie27
dcurrie27

Reputation: 359

After searching and toying I came across this which works:

find -L . -name 'my_website.html' -print0 | xargs -0 -n 1 open

Upvotes: 1

Related Questions