eza-community / eza

A modern, maintained replacement for ls
https://eza.rocks
MIT License
8.88k stars 170 forks source link

feat: displayed directory sizes #252

Open zdzichu opened 10 months ago

zdzichu commented 10 months ago

If eza does something unexpected, or its output looks wrong, or it displays an error on the screen, or if it outright crashes, then please include the following information in your report:

If it’s a crash, please include the full text of the crash that gets printed to the screen. If you’re seeing unexpected behaviour, a screenshot of the issue will help a lot.


version: v0.11.0 [+git] cmdline: -lb platform: Linux 6.4.11 and corresponding CephFS

(this is a copy of https://github.com/ogham/exa/issues/608, because this issue is still present in eza)

Exa is not printing directory sizes. I can understand rationale – for most filesystems directory size is rather meaningless and mostly has to do with internal fs structures. But, there are filesystems – like cephfs – which do have sensible idea of directory size. For cephfs, directory size corresponds to amount of data inside – you can think of it as built-in du in filesystem.

For example, compare

ls -lah output:

drwxrwxr-x.  3 zdzichu  zdzichu   90G 11-06 16:37 'Collection 1'
-rw-------.  1 root     root     283G 10-05 01:16  fisia-laptopa.dane.img.zst
drwxr-xr-x. 17 root     root      11M 09-23 15:45  postfix
drwxr-xr-x.  2 cherokee cherokee  15M 11-24 00:02  var_log_cherokee

exa -lb output:

drwxrwxr-x@     - zdzichu   6 lis 16:37 Collection 1
.rw-------  282Gi root      5 paź  1:16 fisia-laptopa.dane.img.zst
drwxr-xr-x@     - root     23 wrz 15:45 postfix
drwxr-xr-x@     - cherokee 24 lis  0:02 var_log_cherokee

Either switch to show directory size or whitelist of sensible filesystem would be nice to have.

cafkafk commented 10 months ago

This seems more like a feature request, labeling accordingly.

Solarunit commented 9 months ago

I would like to have an option to display directories size too. Maybe it would slow down the output, I don't know..

gierens commented 5 months ago

The PR https://github.com/eza-community/eza/pull/533 added the --total-size option, which seems to be exactly what you are looking for, so I'm gonna close this.

zdzichu commented 5 months ago

--total-size is similar, but different. `--total-size recursively looks into the directory, which 1) may be slow, potentially traversing petabytes of data; 2) may be confused if the directory contain snapshots.

What I'm asking for is different. If filesystem returns true directory size in stat(), it should be displayed. Most filesystem return garbage as size (ext4 shows multiplies of page size, btrfs shows something related to number of entries inside the directory) but some, like cephfs, show real directory content size. Instantaneously, in bytes, without need to recursively traverse the fs.

gierens commented 5 months ago

Ah alright, I'll reopen it then, sorry for the confusion.

But probably good to have mentioned the --total-size here anyway, as it might be sensible to add the functionality you are asking for as fast path for this argument.