Which command allows you to change the group associated with a file or directory?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Boost your Linux skills with the CompTIA Linux+ Certification Exam simulator. Engage with multiple choice questions and detailed feedback. Master Linux concepts and prepare for your exam with confidence!

The command that allows you to change the group associated with a file or directory is known as "chgrp." This command is specifically designed for modifying the group ownership of a file or directory without altering the user ownership.

When you use chgrp, you specify the desired group name followed by the file or directory name. For example, executing "chgrp developers myfile.txt" would change the group of "myfile.txt" to "developers." This is essential for managing permissions and access control, particularly in a collaborative environment where different users may need varying levels of access based on their group affiliations.

In contrast, the other commands provided serve different purposes. "chown" is used to change both the user and optionally the group of a file or directory. "chmod" is used for altering the permissions of a file or directory. Finally, "ls -l" is a command that lists files and directories along with their associated permissions and ownership details, but it does not modify them. Hence, chgrp is the appropriate choice for this task.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy