coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [FR] du option to show .files/.folders


From: Bob Proulx
Subject: Re: [FR] du option to show .files/.folders
Date: Mon, 22 Jun 2015 00:41:41 -0600
User-agent: Mutt/1.5.23 (2014-03-12)

Yurii Kolesnykov wrote:
> By default du doesn't show disk usage of hidden files/folders.

What?  What makes you think it does not?  The du command does not
treat hidden files or directories special in any way.  They are the
same as any other file.

> There is a workaround for this as answered in this question
> http://askubuntu.com/questions/356902/why-doesnt-this-show-the-hidden-files-folders

I am often amazed at the lengths people will go to fight against the
shell.  This is another good example.  That question is concerning
someone who explicitly is avoiding hidden files.  They are using a
shell file glob ./* which explicitly avoids matching hidden files.
And then complaining that they are not seeing hidden files!  The
insanity of it!

You might want to look at this FAQ:

  
https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#ls-_002da-_002a-does-not-list-dot-files

It explains file globbing in more detail.  In summary the shell is
expanding the shell file globs first before invoking du.  The du
command has no knowledge of the '*' shell metacharacters at all.

When someone gives 'du' a file glob such as "./*" then the shell
expands the file glob to match files in the current directory and then
invokes du with the result.  Use echo to see what du is seeing.  And
at that point you will see that du was invoked with a list of files
and the list of files explicitly did not include any hidden files.

  echo du ./*

If you want to list all of the files in the current directory then
either use '.' or don't give it any file arguments at all.  Also you
may want to use the -d, --max-depth=N option.

Try this:

  du -hd1

> But this command is so weird, so I can manage to remember it. So I created
> alias, but while I do so I thought that it will be good to have such
> option, for example '--all-flle-names'.

Such a thing is not needed.

Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]