剔除杜命令的输出隐藏文件与--exclude中,grep -v或sed的 [英] Excluding hidden files from du command output with --exclude, grep -v or sed

查看:312
本文介绍了剔除杜命令的输出隐藏文件与--exclude中,grep -v或sed的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想请与磁盘使用的工具有多大我的主目录文件夹,但它也打印出文件夹和文件开始点。

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 "?"

先谢谢了。

编辑>
感谢您的 SiegeX 为你解答。

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

由于点相匹配,我们必须与自也是一个特殊字符双反斜线preFIX任何字符。

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

推荐答案

如果运行 DH 没有指定路径(当前目录),使用:

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

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

这篇关于剔除杜命令的输出隐藏文件与--exclude中,grep -v或sed的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆