Help Center/ Bare Metal Server/ FAQs/ OS FAQ/ Common Linux Commands
Updated on 2022-09-15 GMT+08:00

Common Linux Commands

lsblk

The lsblk command is used to list all available block devices and the dependencies between them, except the RAM disks. Block devices include hard disks, flash memory, and CD-ROM.

By default, the lsblk command lists all block devices in a tree structure. Start the terminal and run the following command:

lsblk
NAME    MAJ:MIN  RM  SIZE RO TYPE  MOUNTPOINT
sda     202:0    0   40G  0  disk 
├─sda1 202:1   0    4G  0  part  [SWAP]
└─sda2 202:2   0   36G  0  part  /
sdb     202:16   0   10G  0  disk

The parameters are as follows:

  • NAME: block device name
  • MAJ:MIN: primary and secondary device numbers
  • RM: whether the device is removable. 0 indicates no and 1 indicates yes.
  • SIZE: device capacity
  • RO: whether the device is read-only. 0 indicates no and 1 indicates yes.
  • TYPE: block device type (disk or a disk partition)
  • MOUNTPOINT: mount point of a device