How do I see my disks Ubuntu terminal?

Getting to Know Your Disks in the Ubuntu Terminal

When it comes to managing and maintaining your Ubuntu system, understanding your disk structure and available storage space is crucial. In this article, we will explore how to view your disks using the Ubuntu terminal.

How do I see my disks in the Ubuntu terminal?

Before we dive into the details, it’s essential to know that Ubuntu provides a variety of ways to view your disks. Here are a few ways to do so:

  • Using the lsblk command: One of the most straightforward ways to view your disks is by using the lsblk command. This command provides a simple and easy-to-read output that displays information about your disks, including their size, type, and mount points.

In-depth: Using lsblk Command

To use the lsblk command, simply open your terminal and type lsblk followed by the Enter key. The output will display a list of disks, their respective mount points, and other relevant information. Here’s a breakdown of the output:

  • DEVICE: The device name of the disk (e.g., /dev/sda1).
  • MAJ:MIN: The major and minor device numbers of the disk.
  • SIZE: The size of the disk in bytes.
  • RO: Whether the disk is read-only (RO) or not (RW).
  • TYPE: The type of disk (e.g., disk, partition, or crypt).

Here’s an example of the output:

lsblk
NAME MAJ:MIN RO SIZE TYPE MOUNTPOINT
sda 8:0 0 1000G disk /
sda1 8:1 0 500M part /boot
sda2 8:2 0 900G part
sda5 8:5 1 100M crypt /home/

  • Using the df command: Another way to view your disks is by using the df command. This command provides information about the disk space usage for each mount point.

In-depth: Using df Command

To use the df command, simply open your terminal and type df -h followed by the Enter key. The output will display a list of mount points, the total and used disk space, and the available free space.

Here’s a breakdown of the output:

Mountpoint Total Used Free Type
/ 1.0G 500M 450M ext4
/boot 500M 100M 400M ext2
/home 1.0G 300M 700M ext4

Tips and Tricks

  • Use sudo to run commands with elevated privileges: If you’re unsure about running a command, you can use sudo to run it with elevated privileges.
  • Use | to pipe output to other commands: The | symbol is used to pipe output to other commands. For example, lsblk | grep sda will list only devices with the name sda.
  • Use the man command to view manual pages: The man command allows you to view the manual pages for a particular command or function. For example, man lsblk will display the manual page for the lsblk command.

Conclusion

In this article, we’ve explored how to view your disks using the Ubuntu terminal. We’ve covered two essential commands: lsblk and df. By understanding how to use these commands, you’ll be able to manage and maintain your disk space effectively. Remember to use sudo to run commands with elevated privileges, and to pipe output to other commands using the | symbol. With this knowledge, you’ll be better equipped to troubleshoot and manage your Ubuntu system.

Unlock the Future: Watch Our Essential Tech Videos!


Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top