0
0
Linux CLIscripting~3 mins

Why fdisk and lsblk in Linux CLI? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

What if a few simple commands could save your data and sanity when managing disks?

The Scenario

Imagine you just bought a new hard drive and want to use it on your Linux computer. You try to figure out its size, partitions, and how to set it up by opening multiple windows, guessing device names, and writing notes on paper.

The Problem

Doing this by hand is slow and confusing. You might mix up device names, miss important details, or accidentally delete data. Without clear commands, it's easy to make mistakes that can cause data loss or system problems.

The Solution

Using fdisk and lsblk commands lets you quickly see all disks and partitions, and safely create or modify partitions. They give clear, organized information and simple interactive tools to manage disks without guesswork.

Before vs After
Before
cat /proc/partitions
ls /dev/sd*
# guess which device is new
After
lsblk
fdisk -l
# see all disks and partitions clearly
What It Enables

You can confidently manage disk partitions and storage devices, making your system setup faster, safer, and less stressful.

Real Life Example

When installing a new Linux system, you use lsblk to list all drives and fdisk to create partitions for system, swap, and data, ensuring everything is correctly set up before installation.

Key Takeaways

Manual disk management is confusing and risky.

fdisk and lsblk provide clear, safe ways to view and edit disk partitions.

They save time and prevent costly mistakes when handling storage devices.