Ubuntu – How to combine the find command with other commands so I don’t have to navigate to the folder

command linefindlocatepython

Sometimes I want to run certain files, but I don't want to navigate all the way to the folder.

If I know the file name and find -name file_name.py only returns one result, can I just use that?

For example, instead of navigating all the way to a specific folder and calling:

python file_name.py

Can I write:

python [ find -name file_name.py ] 

or

python [ locate file_name.py ]

Or some sort of variant for 'search my entire computer for this file name and use it'? Preferably in one line.

Best Answer

I think you're looking for:

python $(find -name myscript.py)