coreutils
[Top][All Lists]
Advanced

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

Re: du feature


From: Bernhard Voelker
Subject: Re: du feature
Date: Sun, 31 Jan 2016 14:09:17 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 01/31/2016 01:26 PM, Bernhard Voelker wrote:
> On 01/31/2016 04:05 AM, Andrew Zwieg wrote:
>>
>> I'd like to request a feature for coreutils, specifically 'du'. I have a 
>> situation where root(/)  typically fills up alot(It would be easier to 
>> change this situation, however that's not an option), So what i'm left with 
>> is if you do du -sh /*, it makes a mess when it gets to /home if you have 
>> root squashed home directories. It would be really nice to have an exclude 
>> flag, such as '-e' to exclude /home, or other directories. 
>>
>> I'm aware we can do something similar with find, in a rather un-easy syntax 
>> to remember, and 3 pipes; it seems this is more appropriate in the 'du' 
>> tool. 
>> I took a look over the rejected feature request, and found the below link, 
>> It appears to be a different than the feature I'm requesting, because of the 
>> nature of wanting to ignore the size, not the directory itself.  
>> http://lists.gnu.org/archive/html/coreutils/2013-04/msg00043.html
>>
>>
>> looking forward to you feedback.
> 
> If I understand you correctly, then you want a combination of
> 
>   -d, --max-depth=N     print the total for a directory (or file, with --all)
>                           only if it is N or fewer levels below the command
>                           line argument;  --max-depth=0 is the same as
>                           --summarize
> and
> 
>   -x, --one-file-system    skip directories on different file systems
> 
[...]
> FWIW, you may also be interested in the --threshold option, e.g.:

I forgot the obvious:
If /home is really on the same file system as '/', then you can use
the already-existing --exclude or --exclude-from option:

For demonstration purposes, I'm excluding /srv, /root and /lost+found
here:

  $ du -hx -d1 --exclude=/srv --exclude=/root --exclude=/lost+found /
  6.8G    /usr
  1.2G    /tmp
  34M     /etc
  18M     /lib64
  6.1G    /var
  4.0K    /mnt
  4.0K    /opt
  4.0K    /selinux
  4.8M    /bin
  392M    /lib
  55M     /boot
  28K     /media
  9.1M    /sbin
  12K     /dir
  12K     /dir2
  15G     /

You can do the same with -X reading from stdin:

  $ printf "/%s\n" srv root lost+found \
      | du -X - -hxd 1 /

Finally, I guess the directories in '/' are not varying so much;
therefore you could simply use a positive list of typically growing
candidates:

  $ du -shx /usr /var /tmp

Have a nice day,
Berny



reply via email to

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