locate and copy found file to selected location

Hello Experts,

How can I combine two tasks in one line.

locate aaa.xxx
cp "the file we found" "to current location"

Thank you

Who is Participating?
woolmilkporcConnect With a Mentor Commented:
cp $(locate aaa.xxx) .

Please note the space and the dot (" .") at the end.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.