On 01.05.23 15:34, Stuart Henderson wrote:
That seems better to me. But... an _incompatible_ clone

I wrote "incompatible", because it doesn't support all the options of the original lsblk(8). It also doesn't print exactly the same output as the original. That's why it's incompatible (from my perspective). If I'll ever reach the point of full compatibility, I'll drop the "incompatible", but I don't think it's necessary, since most people only write `lsblk`, without any options.


does that really give us more than df -h

df shows the mounted filesystems.
lsblk shows the attached block devices.
There's a difference:
1. Not all attached block devices are mounted
2. Not all mounted filesystems are on a block device
3. df doesn't show the partition size, it shows the filesystem size (they can be different)
4. df doesn't show the type of the filesystem
5. df doesn't show swap partitions


The main reason for writing lsblk was to make it easier to find _which_ device to mount, not to replace df.
If you want to know the filesystem usage, use df.

I know that `sysctl hw.disknames` can be used to see all block devices (that's what lsblk uses), but it doesn't show any other information about the device. You'd have to do `disklabel dev` afterwards, which is a little cumbersome.

Another reason to use lsblk over disklabel is that lsblk scales the values automatically, while disklabel requires `-p unit`.


Best regards,
Benjamin Stürz

Reply via email to