25

I'm trying to check with Disk Usage tool how big are my home directory folders but it also prints out folders and files starting with dot.

I can't seem to filter them out.

du -h --exclude="?"
du -h | grep -v "?"
du -h | grep -ve "?"
du -h | sed "?"

Thanks in advance.

edit> Thank you SiegeX for you answer.

du -h --max-depth=1 | grep -v "./\\."

Since dot matches any character we have to prefix it with double backslash since its also a special character.

sebastian_t
  • 2,241
  • 6
  • 23
  • 39

2 Answers2

33

If running du with no specified path (current dir), use this:

du -h --exclude "./.*"
SiegeX
  • 135,741
  • 24
  • 144
  • 154
0

From du manual (Use man du to see the manual):

-I mask files and directories matching the specified mask.

In your case this command should work when executed in in desired path.

du -h -I [^.]*
Mateusz Dorobek
  • 702
  • 1
  • 6
  • 22