Challenge - 5 Problems
chgrp Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
π» Command Output
intermediate2:00remaining
What is the output of this chgrp command?
You have a file named
report.txt owned by user alice and group staff. You run the command chgrp developers report.txt. What will be the group of report.txt after this command?Attempts:
2 left
π‘ Hint
Think about what
chgrp does and whether the group exists.β Incorrect
The
chgrp command changes the group ownership of a file. If the group developers exists and you have permission, the file's group changes to developers.π» Command Output
intermediate2:00remaining
What error does this chgrp command produce?
You run the command
chgrp admin secret.txt but you are not the owner of secret.txt and not root. What error message will you most likely see?Attempts:
2 left
π‘ Hint
Think about permission requirements for changing group ownership.
β Incorrect
Only the file owner or root can change the group ownership. Without permission,
chgrp returns 'Operation not permitted'.π Syntax
advanced2:00remaining
Which chgrp command correctly changes group recursively?
You want to change the group of the directory
project and all its files and subdirectories to team. Which command is correct?Attempts:
2 left
π‘ Hint
Check the correct option for recursive change in chgrp.
β Incorrect
The correct options for recursive change are
-R and --recursive. -r is not recognized.π Application
advanced2:00remaining
How to change group of multiple files using chgrp?
You have files
file1.txt, file2.txt, and file3.txt. You want to change their group to editors in one command. Which command will do this?Attempts:
2 left
π‘ Hint
Think about how chgrp accepts multiple files as arguments.
β Incorrect
You can list multiple files separated by spaces in one chgrp command to change their group.
π§ Conceptual
expert2:00remaining
What happens if you run chgrp with a non-existent group?
You run
chgrp ghostgroup file.txt where ghostgroup does not exist on the system. What will happen?Attempts:
2 left
π‘ Hint
Think about how chgrp validates group names.
β Incorrect
If the group does not exist, chgrp returns an error indicating the group is invalid.