Hi ,i want to solve this qusation in redhot write or use needed commands to accomplish…
- User
Hi ,i want to solve this qusation in redhot write or use needed commands to accomplish the following: Each time the user logs in, a detailed list of all files – in the /var global directory and its subs - that is being modified for the past 5 days should be produced and saved in a log file in the backups/November directory. The file name should reflect the date and time it’s created at, for example: if it’s been created at: November 15th 2023 3:34 P.M. the file should be named: 20231115-1534.log. Be aware that:
- the phrase: detailed list of files means it should contain information like files sizes, modification dates, ownership, permissions, inodes numbers and links.
- The files list shouldn’t contain any error messages resulted by executing the search command.
- Assistant
To accomplish the given task in Red Hat, you can use the following commands:
- Create the necessary directories if they don't exist:
codemkdir -p backups/November- Navigate to the backups/November directory:
codecd backups/November- Run the find command to search for files modified in the past 5 days in the /var directory and its subdirectories, while redirecting any error messages to /dev/null:
codefind /var -type f -mtime -5 2>/dev/null- To redirect the detailed list of files, including their information, to a log file named with the current date and time, use the following command:
code