exam questions

Exam EX200 All Questions

View all questions & answers for the EX200 exam

Exam EX200 topic 1 question 79 discussion

Actual exam question from RedHat's EX200
Question #: 79
Topic #: 1
[All EX200 Questions]

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.

Show Suggested Answer Hide Answer
Suggested Answer: See explanation below.
(1)find /etc -size 10k -exec cp {} /tmp/findfiles \;
(2)find / -user lucy -exec cp -a {} /tmp/findfiles \;
Note: If find users and permissions, you need to use cp - a options, to keep file permissions and user attributes etc.

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
jjknow85
Highly Voted 3 years ago
#mkdir /tmp/findfiles # find /etc -size 10k -exec cp -r {} /tmp/findfiles \; # find / -user lucy -exec cp -r {} /tmp/findfiles \;
upvoted 7 times
ly01
4 months, 3 weeks ago
I would use cp -a to preserve the ownership.
upvoted 1 times
Lazylinux
3 months, 2 weeks ago
I would NOT use -a as ownership is not carried over, better use -P -p => Preserves file characteristics (modification time, access time, ownership, permission-bits). -a, --archive Preserve the source's metadata, such as creation date, permissions, and extended attributes
upvoted 1 times
...
...
...
Frenzy
Most Recent 2 years, 6 months ago
mkdir /tmp/findfiles cp $(find /etc -size 10k) /tmp/findfiles/ cp $(find / -user lucy) /tmp/findfiles/
upvoted 2 times
...
mattd81
2 years, 7 months ago
How would you check to see what is in the directory to verify your search?
upvoted 1 times
...
STFN2019
3 years, 2 months ago
Why not just use the following: find /etc -size 10k > /tmp/findfiles find / -user lucy >> /tmp/findfiles
upvoted 1 times
atilade
3 years, 2 months ago
/tmp/findfiles is a directory. You can only append to files
upvoted 3 times
...
reemartan
3 years, 1 month ago
This is just redirecting your command output to a file, but not copying the files to a directory
upvoted 3 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...