Exam EX200 Topic 6 Question 45 Discussion
Actual exam question for RedHat's EX200 exam
Question #: 45
Topic #: 6
Question #: 45
Topic #: 6
Create a script to search for files
* Create a script named myresearch
* Place the script under /usr/local/bin
* The script is used to search for all files under /usr that are smaller than 10 MB and have group write permission, and place these files into /root/myfiles
* Create a script named myresearch
* Place the script under /usr/local/bin
* The script is used to search for all files under /usr that are smaller than 10 MB and have group write permission, and place these files into /root/myfiles
Suggested Answer:
Solution:
mkdir /root/myfiles
vim /usr/local/bin/myresearch
#!/bin/bash
find /usr -type f -and -size -10M -and -perm -2000 -exec cp -a {} /root/myfiles \;
:wq
chmod +x /usr/local/bin/myresearch
bash /usr/local/bin/myresearch
ll -h /root/myfiles
Script explanation:
(#!/bin/bash): #! is a conventional marker that tells the system which interpreter should be used to execute the script.
/bin/bash means the script is executed using the default Bash shell.
Here, a for loop is needed to iterate over the found GIDs (group IDs) for processing.
(awk -F':' '{print $3}' /etc/group):
awk is used to split and process text.
-F specifies the field separator.
":" indicates that the colon is used as the delimiter.
{print $3} prints the third field (the group ID).
mkdir /root/myfiles
vim /usr/local/bin/myresearch
#!/bin/bash
find /usr -type f -and -size -10M -and -perm -2000 -exec cp -a {} /root/myfiles \;
:wq
chmod +x /usr/local/bin/myresearch
bash /usr/local/bin/myresearch
ll -h /root/myfiles
Script explanation:
(#!/bin/bash): #! is a conventional marker that tells the system which interpreter should be used to execute the script.
/bin/bash means the script is executed using the default Bash shell.
Here, a for loop is needed to iterate over the found GIDs (group IDs) for processing.
(awk -F':' '{print $3}' /etc/group):
awk is used to split and process text.
-F specifies the field separator.
":" indicates that the colon is used as the delimiter.
{print $3} prints the third field (the group ID).
by Bella at Oct 15, 2026, 08:12 AM
0
0
0
10
Comments
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.
Report Comment
Commenting
You can sign-up / login (it's free).