0
0
Linux CLIscripting~10 mins

fdisk and lsblk 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 command to list all block devices on your system.

Linux CLI
lsblk [1]
Drag options to blanks, or click blank then click option'
A-m
B-l
C-a
D-f
Attempts:
3 left
💡 Hint
Common Mistakes
Using -a shows all devices including empty ones, but not in list format.
Using -f shows filesystem info, not the device list.
Using -m shows permissions, not the device list.
2fill in blank
medium

Complete the command to start fdisk on the device /dev/sda.

Linux CLI
sudo fdisk [1]
Drag options to blanks, or click blank then click option'
A/dev/sda
B/dev/sdb
C/dev/sdc
D/dev/sdd
Attempts:
3 left
💡 Hint
Common Mistakes
Using /dev/sdb or other devices when the main disk is /dev/sda.
Forgetting to use sudo for administrative privileges.
3fill in blank
hard

Fix the error in the command to print detailed info about partitions using lsblk.

Linux CLI
lsblk [1]
Drag options to blanks, or click blank then click option'
A-o NAME,SIZE,TYPE,MOUNTPOINT
B-p
C-d
D-r
Attempts:
3 left
💡 Hint
Common Mistakes
Using -d shows only devices, no partitions.
Using -p shows full device paths but not detailed columns.
Using -r shows raw output, not formatted columns.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps partition names to their sizes using lsblk output.

Linux CLI
sizes = { [1]: [2] for part in partitions }
Drag options to blanks, or click blank then click option'
Apart
Bpart.size
Cpart.name
Dpart.mountpoint
Attempts:
3 left
💡 Hint
Common Mistakes
Using mountpoint instead of size for values.
Using the same variable for key and value.
5fill in blank
hard

Fill all three blanks to filter partitions larger than 1G and create a dictionary of their names and sizes.

Linux CLI
large_parts = { [1]: [2] for p in partitions if [3] > 1_000_000_000 }
Drag options to blanks, or click blank then click option'
Ap.name
Bp.size
Dp.mountpoint
Attempts:
3 left
💡 Hint
Common Mistakes
Using mountpoint instead of size for filtering.
Using inconsistent variable names.