Which of the following shell scripts will accomplish this task?

A Linux administrator wants to obtain a list of files and subdirectories in the /etc directory that contain the word "services". Once the files and subdirectories are discovered, they should be listed alphabetically in the /var/tmp/ foundservices file. Which of the following shell scripts will accomplish this task?
A. #/bin/bash find /etc -name services | sort > /var/tmp/foundservices
B. #/bin/bash locate /etc -sort -name services > /var/tmp/foundservices
C. #/bin/bash find -name services -sort </var/tmp/foundservices
D. #/bin/bash find /etc -name services -sort > /var/tmp/foundservices

comptia-exams

3 thoughts on “Which of the following shell scripts will accomplish this task?

      1. find and locate do not have any option named sort. this is why sort goes after |, because it’s an entirely different command. B,C,D are not possible.
        A is correct.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.