Exam EX200 All QuestionsBrowse all questions from this exam
Question 78

SIMULATION -

1. Find all sizes of 10k file or directory under the /etc directory, and copy to /tmp/findfiles directory.

2. Find all the files or directories with Lucy as the owner, and copy to /tmp/findfiles directory.

    Correct Answer:

    To accomplish the tasks specified in the question, you need to use the 'find' command to locate the relevant files and then copy them to the '/tmp/findfiles' directory. Here are the correct commands for each task: 1. To find all files or directories of 10k size under the '/etc' directory and copy them to '/tmp/findfiles' directory, use: 'find /etc -size 10k -exec cp -a {} /tmp/findfiles \;'. The '-a' option is used with 'cp' to preserve file attributes, including ownership and permissions. 2. To find all files or directories owned by the user 'lucy' and copy them to '/tmp/findfiles' directory, use: 'find / -user lucy -exec cp -a {} /tmp/findfiles \;'. Again, the '-a' option is used to ensure that the file attributes are preserved during the copy operation.

Discussion
jjknow85

#mkdir /tmp/findfiles # find /etc -size 10k -exec cp -r {} /tmp/findfiles \; # find / -user lucy -exec cp -r {} /tmp/findfiles \;

ly01

I would use cp -a to preserve the ownership.

Frenzy

mkdir /tmp/findfiles cp $(find /etc -size 10k) /tmp/findfiles/ cp $(find / -user lucy) /tmp/findfiles/

mattd81

How would you check to see what is in the directory to verify your search?

STFN2019

Why not just use the following: find /etc -size 10k > /tmp/findfiles find / -user lucy >> /tmp/findfiles

atilade

/tmp/findfiles is a directory. You can only append to files

reemartan

This is just redirecting your command output to a file, but not copying the files to a directory