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.
df [options] [file|directory]
This will display disk usage information in a human-readable format.
2. du (Disk Usage)
du command is used to estimate file and directory space usage.
du [options] [file|directory]
du -sh /path/to/directory
This will show the total space used by the specified directory.
3. lsblk (List Block Devices)
lsblk command lists information about block devices (such as hard drives, SSDs, etc.) and their partitions.
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.
sudo fdisk -l
sudo parted -l
These commands will display information about disk partitions.
smartctl command is used to monitor the health and attributes of hard drives and SSDs.
smartctl [options] device
sudo smartctl -a /dev/sda
This will display detailed information about the specified device’s SMART attributes.
- 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.