CompTIA Linux+ (XK0-005) — Question 34

Due to low disk space, a Linux administrator finding and removing all log files that were modified more than 180 days ago. Which of the following commands will accomplish this task?

Answer options

Correct answer: C

Explanation

Option C is correct because it properly uses the 'find' command to locate files (-type f) in the /var/log directory that were modified more than 180 days ago (-mtime +180) and executes the 'rm' command to delete them. Option A incorrectly specifies 'type d' for directories instead of files, while Option B uses '-modified' which is not a valid option in the 'find' command, and Option D uses 'type c' which is for character devices, not log files.