开发者

Excluding hidden files from du command output with --exclude, grep -v or sed

开发者 https://www.devze.com 2023-02-20 13:57 出处:网络
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'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 Siege开发者_JAVA技巧X 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.


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

du -h --exclude "./.*"
0

精彩评论

暂无评论...
验证码 换一张
取 消