Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the command to list file permissions in long format.
Linux CLI
ls -l [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-r' which reverses order but does not affect permissions display.
Using '-h' which shows sizes in human-readable format but not permissions.
✗ Incorrect
The '-l' option lists files in long format showing permissions. The blank expects a directory or file to list. '/home/user' is a valid path to list. '-a' shows hidden files but is not necessary to list permissions. So the correct answer is 'B'.
2fill in blank
mediumComplete the command to change the owner of a file named 'report.txt' to user 'alice'.
Linux CLI
chown [1] report.txt Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the filename instead of the username.
Using 'root' or 'user' without context.
✗ Incorrect
The 'chown' command changes the owner of a file. To set the owner to 'alice', you use 'chown alice filename'.
3fill in blank
hardFix the error in the command to add execute permission for the user on 'script.sh'.
Linux CLI
chmod u[1] script.sh Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-x' which removes execute permission.
Using '+r' which adds read permission instead.
✗ Incorrect
To add execute permission for the user, use 'chmod u+x filename'. The '+' adds permission, 'x' is execute.
4fill in blank
hardFill both blanks to create a command that sets read and write permissions for the group on 'data.txt'.
Linux CLI
chmod g[1][2] data.txt
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Adding execute permission instead of read or write.
Removing permissions with '-' instead of adding.
✗ Incorrect
To give read and write permissions to the group, use 'chmod g+r+w filename'.
5fill in blank
hardFill all three blanks to create a dictionary comprehension in Python that maps filenames to their sizes only if size is greater than 1000.
Linux CLI
sizes = [1]: [2] for [3] in files if os.path.getsize([3]) > 1000
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Not calling 'os.path.getsize' correctly.
✗ Incorrect
The comprehension maps each 'file' to its size using 'os.path.getsize(file)' for files in the list 'files'.