0
0
Linux CLIscripting~5 mins

chgrp (change group) in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the chgrp command do in Linux?
The chgrp command changes the group ownership of a file or directory to a specified group.
Click to reveal answer
beginner
How do you change the group of a file named report.txt to staff?
Use the command: chgrp staff report.txt to change the group ownership of report.txt to staff.
Click to reveal answer
intermediate
Can chgrp change the group of multiple files at once? How?
Yes. You can list multiple files after the group name, like chgrp staff file1.txt file2.txt, to change their group ownership all at once.
Click to reveal answer
intermediate
What option do you use with chgrp to change groups recursively for directories and their contents?
Use the -R option: chgrp -R staff /path/to/directory changes the group for the directory and all files inside it.
Click to reveal answer
beginner
Who can change the group ownership of a file using chgrp?
Only the file owner or the superuser (root) can change the group ownership of a file using chgrp.
Click to reveal answer
What does the command chgrp developers project.txt do?
ACreates a new group called developers
BChanges the owner of project.txt to developers
CDeletes the project.txt file
DChanges the group of project.txt to developers
Which option allows chgrp to change groups for all files inside a directory?
A-f
B-a
C-R
D-v
Who can use chgrp to change a file's group?
AOnly the file owner or root
BOnly users in the new group
COnly root
DAny user
What happens if you run chgrp staff file1.txt file2.txt?
AChanges group of file1.txt only
BChanges group of both files to staff
CChanges group of file2.txt only
DCreates two new files
If you want to see what chgrp is doing, which option should you add?
A-v
B-q
C-s
D-n
Explain how to change the group ownership of a file and what permissions are needed.
Think about who owns the file and the command format.
You got /3 concepts.
    Describe how to change the group ownership of all files inside a directory.
    Consider how to apply changes to multiple files at once.
    You got /3 concepts.