Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to change the group of the file example.txt to staff.
Linux CLI
chgrp [1] example.txt Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a username instead of a group name.
Forgetting to specify the group name.
✗ Incorrect
The
chgrp command changes the group ownership of a file. Here, staff is the target group.2fill in blank
mediumComplete the code to change the group of all files in the current directory to developers.
Linux CLI
chgrp [1] * Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong group name.
Not using the wildcard
* to select all files.✗ Incorrect
The asterisk
* selects all files in the current directory. The group developers is assigned to all of them.3fill in blank
hardFix the error in the command to recursively change the group of the directory project and all its contents to team.
Linux CLI
chgrp -[1] team project Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase
-r which is not recognized by chgrp.Forgetting the recursive option.
✗ Incorrect
The option
-R (uppercase) tells chgrp to apply changes recursively to all files and subdirectories.4fill in blank
hardFill both blanks to change the group of file.txt to admins and show the command output.
Linux CLI
chgrp [1] file.txt && ls -l [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong file name in the second command.
Confusing options with file names.
✗ Incorrect
First, the group is changed to
admins. Then, ls -l file.txt lists the file details showing the new group.5fill in blank
hardFill all three blanks to recursively change the group of docs directory to editors, force no error messages, and list the directory contents.
Linux CLI
chgrp -[1] [2] editors docs && ls [3] docs
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase
-r instead of uppercase -R.Omitting the force option
-f.Not using
-l to list detailed file info.✗ Incorrect
Use
-R for recursive, -f to suppress errors, and -l to list details of the docs directory.