Command or tool for terminal to report disk space but as a kind of TUI (Terminal User Interface)?

Hello Friends

I use GParted as the main GUI when I want see globally stats about disk space for a HD/SSD. It externally (boot through ventoy) or even within the same OS itself.

Furthermore in gnome I know about Disk Usage Analyzer

Is there a kind of command or tool for terminal to report disk space but as a kind of TUI (Terminal User Interface)? Such as:

I hope you see my point

Thank You

3 Likes

There is df -h but it only reports mounted partitions.
and
there is fdisk -l device which lists partition table
be careful with fdisk
also cfdisk

To see all partitions lsblk
and to get more info blkid

But I cant think of anything that puts it all together like gparted does.
except, parted is a cli version of gparted… that may be what you want?

The gnome-disks utility is gui. What you is something with ncurses or dialog? There may be something that would render a gui with ncurses or dialog?

Sorry, that is not really what you want

3 Likes

parted isn’t just “cli” - if you run it as is - you enter an interactive TTY style “shell” - it’s not really a proper “tui” (i.e. not a TUI like nmtui)… I think it defaults to the device you run it from (e.g. on my Pop!_OS it’s /dev/mapper/cryptdata).

I have maybe used it 3-4 times in my whole career… I think I had to use it once 'cause fdisk couldn’t handle something on the block device partition table…

But I hardly ever partition disks manually - on desktop machines with a DE I usually let the installer take care of partitioning to the vendor defaults - mostly happy to accept Ubuntu and Pop!_OS defaults (but kinda hate Fedora’s!)… I also never dual boot (at least not for a while) so most of my Linux systems have a single “/” that hosts everything (e.g. /var, /home)…

3 Likes

I must admit I have never run it.
That is very close to what @Manuel_Jordan wants.

There are a few TUI things in Antix… I will have a look there.

3 Likes

I see one called dust.

It’s cover at It’s FOSS.

ncdu

Pretty sure I’ve seen others but can’t think of them right now.

4 Likes

What I see is complicated tools replacing simple tools… with the possible exception of fd
Is that the right direction?

2 Likes

@Manuel_Jordan :

Hi Manuel, :waving_hand:

For a quick overview I often make use of duf.

whatis duf
duf (1)              - Disk Usage/Free Utility

Looks like this:

Many greetings from Rosika :slightly_smiling_face:

4 Likes

Huge thanks to all for your time and replies

Pls give me some time to check each answer

Thanks for your understanding

A cold beer to all you :beer_mug: - well deserved!

1 Like

Hi Rosika,

Your disk is quite full🤭

Thanks for the tip! Duf was new to me. I usually go lsblk, mount partitions I like to check and then df -hl or just use Gparted.

4 Likes

I couldn’t think of duf. I have used that.

Typically I just use:

df -h
du -hs *

But duf is pretty simple, I think. It seems easier than navigating around and issuing the individual commands again and again.

4 Likes

Huge thanks @Rosika

So far it is the unique suggested tool tested because you included a Figure of the output. I think it is the best for the terminal about presentation. Of course according with my requirement. I tested but is strange the following:

Because the Linux server is installed through VirtualBox it is stored in a .vdi file. It was created with a size of 50GB. Therefore the “fake” HDD/SSD has only 50GB. When the du command is executed it shows the same structure data. But in none place appears the 50GB.

In other words if in your side your SSD is 500GB or 1TB in your report shared where appears that global data? It including the space already used and available. Therefore as a global report.

If you execute internally GParted as GUI of course, it shows all the partitions as expected but globally it shows the full capacity of the HDD/SSD itself. And if my memory does not fail the used and available space too.

I am assuming would be there an option in the command itself. It seems not (see man duf). But because you already have experience with the command perhaps you already know how to get that global report

Thanks for your understanding

2 Likes

I think duf will be like df … they only report on partitions that are mounted… they do not know about disks, only partitions, so they cant do a global report for a disc.
They also will not see unmounted partitions… you could fix that by mounting every partition, but that would produce some clutter.

4 Likes

Hello Beville

Thanks for the reply … and has sense your point. Therefore:

  • Is there a command that does a global report of all the disk?

In this point giving the report as TUI or not

1 Like

Yes, gparted, or parted, or gnome-disks.
Only parted is tui.
I think also fdisk, but I will have to check.

It would be possible to write a script that finds all the partitions, temporarily mounts them all, does df or duf, then sorts the result into disks. … Want to try?

The basic information is in /dev/disk (may be /dev/disks, cant remember)

3 Likes

Thanks for the reply

Yes, gparted, or parted, or gnome-disks.
Only parted is tui.
I think also fdisk, but I will have to check.

In that case I will to do a research for parted

It would be possible to write a script that finds all the partitions, temporarily mounts them all, does df or duf, then sorts the result into disks. … Want to try?

Wondered why so far there is no a command to accomplish that goal. Due lack of time I will pass/avoid to create a script file. The command should be portable among some distros too. So resolve this case through scripts is other history

The basic information is in /dev/disk (may be /dev/disks, cant remember)

I understand. I will check it

The commands shared - for reporting of partitions work fine - it with or without TUI.
But is interesting how the global report of the complete disk is not straightforward

2 Likes

There’s “fdisk -l” and there’s “lsblk” - I use both…

The output from lsblk is bit easier to decipher sometimes…

[root@rel9-000 system-connections]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda             8:0    0   20G  0 disk 
├─sda1          8:1    0    1G  0 part /boot
└─sda2          8:2    0   19G  0 part 
  ├─rhel-root 253:0    0   17G  0 lvm  /
  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]
sr0            11:0    1 1024M  0 rom

Although - on Ubuntu distros - like Pop!_OS you get a lot of guff about loop filesystems - it’s clutter and gets in the way…

So :

╭─x@titan ~  
╰─➤  lsblk |grep -v loop
NAME            MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
sda               8:0    1     0B  0 disk  
sdb               8:16   1     0B  0 disk  
sdc               8:32   1     0B  0 disk  
sr0              11:0    1  1024M  0 rom   
zram0           251:0    0    16G  0 disk  [SWAP]
nvme0n1         259:0    0 931.5G  0 disk  
├─nvme0n1p1     259:1    0  1022M  0 part  /boot/efi
├─nvme0n1p2     259:2    0     4G  0 part  /recovery
├─nvme0n1p3     259:3    0 922.5G  0 part  
│ └─cryptdata   252:0    0 922.5G  0 crypt 
│   └─data-root 252:1    0 922.5G  0 lvm   /
└─nvme0n1p4     259:4    0     4G  0 part  
  └─cryptswap   252:2    0     4G  0 crypt
3 Likes

Hi all, :waving_hand:

@ihasama :

You´re welcome.
Glad you´re interested in it.

@Manuel_Jordan :

You´re welcome.

Your observations are correct. I just checked on my system, on which I started my virtual machine Arch Linux using KVM/qemu.

The duf utility doesn’t directly show the space used by virtual machine disk images as part of the overall disk usage in its default output.

Note:
For the following I´m taking my qcow2 file for Arch Linux as an example:

However:

  1. you can provide the filepath to the VM file as an argument to duf for showing the
    usage of the entire filesystem where the .qcow2 file is stored, not the specific usage of the virtual machine disk image itself.

  2. The output I´m getting from duf -all that shows /run/qemu is a temporary filesystem (tmpfs) used by QEMU for runtime operations, but it doesn’t represent the actual disk usage of your virtual machine images

On my system it looks like this:

and:

Hope it helps.

@nevj :

Yes, Neville. That´s my understanding as well.

Many greetings to all from Rosika :slightly_smiling_face:

3 Likes

Huge thanks to all again

Dan

There’s “fdisk -l” and there’s “lsblk” - I use both…

Thanks for that suggestions both show the 50GB (full storage space). I have the following results

  • fdisk

  • lsblk (both ways)

Rosika

  • duf

Therefore the 4 commands must be used together to have a complete picture or better understanding

duf
fdisk -l
lsblk
lsblk |grep -v loop

I am giving the solution to @Rosika because the duf command has the expected TUI (but with the constraint of the global report) …

Why I requested the solution with TUI? It because even when the fdisk and lsblk commands are very valuable … in some point of the day when the brain is very tired this kind of report is much better with a kind of graphical presentation. Thus duf is valuable. Again the set of commands shown above do the complete job.

Pls see again the 3 pictures shown above to do a comparison with GParted as follows:

As you can see the GUI is very similar as TUI. And see top-right appears the disk size.

Extra Question

  • What does the “key icon” mean at “/dev/sda3”? (See the Partition column)

And well more properties for a selected partition

What I did do is get the .iso file of GParted and put it as Live CD/DVD for VirtualBox for the VM of my Linux being Server.

Huge thanks to all!!!

3 Likes

Hi Manuel, :waving_hand:

thanks a lot for your feedback.

from: partitioning - Gparted has a little key icon on my Ubuntu partition so I can not resize it - Ask Ubuntu :

That key icon indicates that the partition you are trying to modify is currently under use. In order to modify that/those partition/s you have to boot up from a live CD. Then you will be able to modify those partitions. But, be sure to backup your data as it can lead to data loss. But this case is very rare.

Cheers from Rosika :slightly_smiling_face:

3 Likes

Thanks for the reply Rosika

Is strange the answer of the other network because the Figures shared by my side are Live CD/DVD and thus the OS itself is not running. I think there is something missing there

Take care :slight_smile:

2 Likes