On 2025-03-06 at 21:47, Greg Wooledge wrote:

> On Fri, Mar 07, 2025 at 02:41:33 +0000, Andy Smith wrote:
> 
>> On Thu, Mar 06, 2025 at 09:33:40PM -0500, Maureen Thomas wrote:
>> 
>>> root@debian:/home/maureen# cd /var
>>> 
>>> root@debian:/var# du -sh*
>>> 
>>> du: invalid option -- '*'
>> 
>> Missing space between 'h' and '*' so the '*' was treated as an option,
>> which is invalid. The '*' is unnecessary anyway.
> 
> It's totally necessary.
> 
> root@hobbit:/var# du -sh
> 2.1G    .
> root@hobbit:/var# du -sh *
> 4.0M    backups
> 124M    cache
> 40K games
> 209M    lib
> 4.0K    local
> 0   lock
> 1.8G    log
> 8.0K    mail
> 4.0K    opt
> 2.3M    qmail
> 0   run
> 3.6M    spool
> 32K tmp

My reflex would be to use

# du -h --max=1 /var/

or

root@host:/var# du -h --max=1

which gives very similar results (albeit in a different order) without
the use of the wildcard, but is of course extra typing.

There might be other reasons why the use of the wildcard would be
preferable; the one that springs to my mind is that I would expect it to
skip dotfiles (and dot-directories) if any are present, but I also
wouldn't expect there to be any in /var/.

I use du's '--max=' option fairly frequently, compared to how often I
use du at all. I find it useful, but your mileage may vary.

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to