5 ms·
du -h --max-depth=1 -x I use this frequently to keep an eye on disk used by user directories. It returns the disk space used by each directory in the current d
by thaumaturgy 14y ago
du -h --max-depth=1 -x
I use this frequently to keep an eye on disk used by user directories. It returns the disk space used by each directory in the current directory.
- falcolas 14y agoSo does: du -sh *
- thaumaturgy 14y agoCorrect with one important caveat: because * is a shell expansion, it will not process any directories starting with a ".". e.g., imap maildir directories.
- X-Istence 14y agodu -sh .* * Problem solved.
- thaumaturgy 14y agoYou might be right. I have some recollection of .* stabbing me in the back once before in this command, and I know I put -x (do not traverse file systems) in there for a reason -- but I don't have any notes on why, so I can't say anything smart about it.
- andrewaylett 14y agoThe trouble with that is that it matches '.' and '..', which you probably don't want. I don't tend to have a single character after the dot in a name, so I usually use '.??*'.
- falcolas 14y agoThat's fair, but for the proposed use, checking the size of home directories, .* directories are of little concern. Honestly, when I have to get fine grained enough to dig into disk usage using 'du', I'm rarely concerned with hidden directories (and I typically append a 'c' to the command as well, so if I do have to pay attention to . directories, I will notice the discrepancy between reported sizes).
- thaumaturgy 14y agoWe have lots of imap maildir directories; e.g., ".Junk", ".Trash", ".Sent", ".Inbox", for each mail account on the server. It's kind of a special case though; I'll agree that in all other cases, your version is simpler and easier to remember.
- emmelaich 14y agoYour local maven repo (.m2/repository) can get huge.