0
0
Linux CLIscripting~10 mins

Permission notation (rwxrwxrwx) in Linux CLI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to show the permissions of a file named example.txt.

Linux CLI
ls -l [1]
Drag options to blanks, or click blank then click option'
A-a
B-l
Cexample.txt
D-h
Attempts:
3 left
💡 Hint
Common Mistakes
Using options like -a or -h instead of the filename.
Omitting the filename argument.
2fill in blank
medium

Complete the code 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'
A+x
B-x
C-r
D+r
Attempts:
3 left
💡 Hint
Common Mistakes
Using -x which removes execute permission.
Using +r which adds read permission instead.
3fill in blank
hard

Fix the error in the command to remove write permission for the group on data.txt.

Linux CLI
chmod g[1] data.txt
Drag options to blanks, or click blank then click option'
A-x
B+w
C+x
D-w
Attempts:
3 left
💡 Hint
Common Mistakes
Using +w which adds write permission instead of removing it.
Using -x which removes execute permission instead.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps filenames to their permission strings if the permission starts with 'r'.

Linux CLI
permissions = {file: perm for file, perm in files.items() if perm[1]('r') and perm[0][2]'r'}
Drag options to blanks, or click blank then click option'
Astartswith
B==
C!=
Dendswith
Attempts:
3 left
💡 Hint
Common Mistakes
Using endswith instead of startswith.
Using != instead of ==.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps filenames to their permission length if the permission contains 'x' and length is greater than 5.

Linux CLI
result = { [1]: len([2]) for [1], [2] in perms.items() if 'x' in [2] and len([2]) [3] 5 }
Drag options to blanks, or click blank then click option'
Afilename
Bperm
C>
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same variable name for both key and value.
Using == instead of > for length comparison.