Red Hat Certified System Administrator RHCSA · Free Practice Question Hard
Question 9
Using Red Hat Enterprise Linux 9, write a command to search for all files within the '/etc' directory that have been modified over 90 days ago. Ensure the output of this command is redirected to a file named '90days' located in the '/tmp' directory.
Show model answer
In RHEL 9, you can use the find command to achieve this task. The command would be:
- find /etc -type f -mtime +90 -exec cp {} /tmp/90days \;
This command searches for files (-type f) in the /etc directory that were modified more than 90 days ago (-mtime +90). The -exec option allows executing a command for each file found; here, it copies (cp) these files to '/tmp/90days'.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
