0
0
Linux CLIscripting~15 mins

fdisk and lsblk in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Using fdisk and lsblk to List and Identify Disk Partitions
📖 Scenario: You are managing a Linux system and want to see the details of your disk drives and their partitions. You will use two common commands: fdisk and lsblk. These commands help you understand how your disks are divided and what partitions exist.
🎯 Goal: Learn how to use fdisk to list disk partitions and lsblk to display block devices in a tree format. You will write simple commands to view this information and understand the output.
📋 What You'll Learn
Use the fdisk command with the -l option to list all disk partitions
Use the lsblk command to display block devices in a tree view
Understand how to read the output of both commands
💡 Why This Matters
🌍 Real World
System administrators often need to check disk partitions and usage to manage storage and troubleshoot issues.
💼 Career
Knowing how to use <code>fdisk</code> and <code>lsblk</code> is essential for Linux system administration and automation tasks.
Progress0 / 4 steps
1
List all disk partitions using fdisk
Type the command sudo fdisk -l to list all disk partitions on your system.
Linux CLI
Need a hint?

The fdisk command with -l lists all partitions. You need sudo to run it with the right permissions.

2
Display block devices using lsblk
Type the command lsblk to show all block devices and their partitions in a tree format.
Linux CLI
Need a hint?

The lsblk command shows disks and partitions in a clear tree view.

3
Filter fdisk output for a specific disk
Use the command sudo fdisk -l /dev/sda to list partitions only for the disk /dev/sda.
Linux CLI
Need a hint?

Replace /dev/sda with the disk you want to check. This command shows only that disk's partitions.

4
Show detailed lsblk output with sizes and mount points
Type the command lsblk -o NAME,SIZE,MOUNTPOINT to display device names, sizes, and mount points.
Linux CLI
Need a hint?

The -o option lets you choose which columns to show. Here, you see device names, sizes, and where they are mounted.