Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Using the find command


    I need to use the find command to find files owned by a specific user, and direct/copy them to another directory. This is the syntax that I have used :
    find / -user harry -type f -exec cp {}/root/harryfiles\;
    The destination directory is /root/harryfiles. However when I execute the command above, I get an error :

    Missing argument to exec

    What is the correct command? Please help.


  2. #2
    Quote Originally Posted by anaigini45 View Post
    find / -user harry -type f -exec cp {}/root/harryfiles\;

    try adding spaces after the "{}" variable, and before the "\;", which signifies the end of the "-exec" statement, e.g.:
    find / -user harry -type f -exec cp {}  /root/harryfiles  \;

  3. #3
    Linux Newbie user-f11's Avatar
    Join Date
    Feb 2011
    Sofia, BG
    RE: 'what is the correct command'
    $ find --help
    Copy with mouse left-click and drag, then right-click and copy the text from the terminal, and after that paste it into some text file ... and print it on paper (to have it at hand).

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts