EX200 · Question #19
19. 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…
The correct answer is A. See the below explanation. To satisfy this RHCSA task, create an executable script at /usr/local/bin/myresearch that uses the 'find' command to locate files under /usr that are smaller than 10 MB and have group write permission, then redirect the results to /root/myfiles. The script content should be…
Question
- 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
Options
- ASee the below explanation
How the community answered
(64 responses)- A100% (64)
Explanation
To satisfy this RHCSA task, create an executable script at /usr/local/bin/myresearch that uses the 'find' command to locate files under /usr that are smaller than 10 MB and have group write permission, then redirect the results to /root/myfiles. The script content should be:
#!/bin/bash find /usr -size -10M -perm /g=w > /root/myfiles
Key points: '-size -10M' matches files strictly less than 10 megabytes; '-perm /g=w' (or '-perm /020') matches files where group write permission is set on at least one of the file's permission bits. After creating the file, make it executable with 'chmod +x /usr/local/bin/myresearch'. The output is redirected (>) to /root/myfiles, overwriting it each run, which is typical for this type of task.
Topics
Community Discussion
No community discussion yet for this question.