Exam EX200 Topic 6 Question 45 Discussion

Actual exam question for RedHat's EX200 exam
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

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).

by Bella at Oct 15, 2026, 08:12 AM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
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.

0
0
0
10