Bird
0
0

Which command changes the group of all .conf files under /etc/config and its subdirectories to configgrp, but only affects files, not directories?

hard📝 Application Q8 of 15
Linux CLI - File Permissions and Ownership
Which command changes the group of all .conf files under /etc/config and its subdirectories to configgrp, but only affects files, not directories?
Achgrp configgrp /etc/config/*.conf
Bchgrp -R configgrp /etc/config/*.conf
Cfind /etc/config -type f -name '*.conf' -exec chgrp configgrp {} +
Dfind /etc/config -name '*.conf' -exec chgrp configgrp {} +
Step-by-Step Solution
Solution:
  1. Step 1: Identify requirement

    Change group recursively only for files with .conf extension, excluding directories.
  2. Step 2: Use find with -type f

    find /etc/config -type f -name '*.conf' selects only files.
  3. Step 3: Use -exec chgrp

    Executes chgrp configgrp on each found file.
  4. Step 4: Analyze other options

    chgrp -R configgrp /etc/config/*.conf changes group recursively but includes directories; C is non-recursive; D lacks -type f and affects directories too.
  5. Final Answer:

    find /etc/config -type f -name '*.conf' -exec chgrp configgrp {} + -> Option C
  6. Quick Check:

    Use find -type f with exec chgrp [OK]
Quick Trick: Use find -type f with exec chgrp [OK]
Common Mistakes:
MISTAKES
  • Using chgrp -R changes directories too
  • Omitting -type f includes directories
  • Not using find for recursive selective changes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes