Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam EX200 topic 1 question 37 discussion

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

SIMULATION -
Search files.
Find out files owned by jack, and copy them to directory /root/findresults

Show Suggested Answer Hide Answer
Suggested Answer: See explanation below.
mkdir/root/findfiles
find / -user jack -exec cp -a {} /root/findfiles/ \; ls /root/findresults

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
kenkct
Highly Voted 2 years ago
sudo su mkdir /root/findresults (create folder if doesn't exist) find / -user jack -type f -exec cp {} /root/findresults/ \; ls /root/findresults (to verify)
upvoted 9 times
...
wizojlo
Most Recent 2 weeks, 4 days ago
I have heard from several people that they encountered a slightly modified version of this question, where it was required to include all files with SUID permission. Just add -perm u=s in the command to do so. One person also had this question made so that it must be made into a shell script. So take note ;)
upvoted 1 times
...
schwarztrinker
2 years ago
sudo -i for file in $(find / -user jack -type f); do cp $file /root/findresults/; done
upvoted 1 times
...
brahmimedamine
2 years, 1 month ago
find / -user jack -type f -exec cp -rpvf {} /root/findresults\; 2> /dev/null
upvoted 1 times
...
cb52
2 years, 2 months ago
mkdir -p /root/findresults find / -user jack -type f -exec cp -avrf {} /root/findresults/ \; ls -l /root/findresults
upvoted 2 times
...
ifbaibz
2 years, 3 months ago
mkdir /root/findresults find / -user jack -type f -exec cp -a {}/root/findresults/\: ls /root/findresults
upvoted 1 times
...
vira5489
2 years, 4 months ago
useradd -m jack mkdir /root/findresults find / -u jack -type f -exec cp -rfp {} /root/findresults \;
upvoted 1 times
...
ANI_04
2 years, 5 months ago
Can't we just do " find / -u jack -type f >> /root/findfiles " ?
upvoted 1 times
sirasdf
1 year, 8 months ago
No that won't copy the files that will just copy the results from the find command to a file. The solution is: find / -type f -user jack -exec cp -v {} /root/findresults \;
upvoted 1 times
...
...
sugisho
2 years, 8 months ago
[root@abc ~]# find / -user jack -type f -exec cp -rp {} /root/findfiles/ \; find: ‘/proc/3337/task/3337/fdinfo/6’: No such file or directory find: ‘/proc/3337/fdinfo/7’: No such file or directory cp: cannot create regular file '/root/findfiles/': Not a directory cp: cannot create regular file '/root/findfiles/': Not a directory cp: cannot create regular file '/root/findfiles/': Not a directory cp: cannot create regular file '/root/findfiles/': Not a directory # find / -user jack -type f -exec cp -rp {} /root/findfiles/\; find: missing argument to `-exec'
upvoted 3 times
...
Stachomir
2 years, 8 months ago
cp -rfp $(find / -type f -user jack) /root/findfiles/
upvoted 1 times
xXxM__JxXx
2 years ago
whats the negative impact if i don't include -type f in the command?
upvoted 1 times
...
...
Leepipes101
3 years ago
find / -user jack -exec cp -rfp /root/findfiles/ {} \;
upvoted 1 times
...
rsebayang
3 years, 6 months ago
find / -user jack -exec cp -rfp {} /root/findfiles/
upvoted 1 times
cytron
3 years, 4 months ago
You've forgotten the line termination \; Line should look like this find / -user jack -exec cp -rfp {} /root/findfiles/ \; # RHEL8
upvoted 2 times
danielmaziarczyk
3 years, 3 months ago
Also should be -type f "for files only" find / -user test -type f -exec cp -rp {} /root/findfiles/ \;
upvoted 2 times
danielmaziarczyk
3 years, 3 months ago
mistake should be: find / -user jack -type f -exec cp -rp {} /root/findfiles/ \
upvoted 4 times
ms200
3 years, 2 months ago
miss ; at the the end of the line
upvoted 1 times
PTom
3 years ago
When you search for files only why do you need -r for cp command. The cp -r mean recursively copy directories. It's not an error but why?
upvoted 4 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 ...