Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to list every file that ends with "conf", and output the results to a given file (with the command "find -exec").

I tried this:

find -name *conf -exec /home/ubuntu/myfile

Is this wrong?

share|improve this question

-exec is used for running a program, not printing the output. Use -print to print the output, and shell redirection (>) to store that output in a file:

find -name \*conf -print > /home/ubuntu/myfile

Note that I escaped the * with a backslash; this is because the shell will attempt to match the wildcard before starting find, so if you happened to have a file that ended in conf in the current directory, the shell would replace *conf with that filename (or names) before starting find.

share|improve this answer
find /path -type f -iname "*.conf" > /home/ubuntu/myfile
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .