How to check disk Linux

To check disk usage and other information about disks on a Linux system, you can use several command-line tools. Here are some commonly used commands:

1. df (Disk Free)

This command displays information about the space usage on your file systems.

Syntax:

df [options] [file|directory]

Example:

df -h

This will display disk usage information in a human-readable format.

2. du (Disk Usage)

The du command is used to estimate file and directory space usage.

Syntax:

du [options] [file|directory]

Example:

du -sh /path/to/directory

This will show the total space used by the specified directory.

3. lsblk (List Block Devices)

The lsblk command lists information about block devices (such as hard drives, SSDs, etc.) and their partitions.

Syntax:

lsblk [options]

Example:

lsblk

This will list all block devices and their partitions in a tree-like format.

4. fdisk and parted:

These commands are used for disk partitioning. They allow you to create, delete, and manage disk partitions.

Syntax for fdisk:

sudo fdisk -l

Syntax for parted:

sudo parted -l

These commands will display information about disk partitions.

5. smartctl

The smartctl command is used to monitor the health and attributes of hard drives and SSDs.

Syntax:

smartctl [options] device

Example:

sudo smartctl -a /dev/sda

This will display detailed information about the specified device’s SMART attributes.

6. gnome-disks

  1. If you are using a graphical environment like GNOME, you can use the “Disks” application to visually inspect and manage your disk drives.

Remember to use these commands with caution, especially if you’re dealing with disk partitions or critical data. Always ensure you have the necessary permissions and backups before making any significant changes to your disks.

Knowledge Base Linux
Knowledge Base Linux

Kblinux is an abbreviation for the phrase "Knowledge Base Linux." The website shares instructional articles related to the Linux system. I hope my small blog will reach many people who share the same passion for Linux.

Articles: 40

KbLinux

Typically replies within a day

Hello, Welcome to the site. Please click below button for chatting me through Telegram.