我使用下列语句查找某个目录的大文件:
find . -type f -exec ls -s {} \; | sort -n -r | head -5
但是如果我想排除其中的目录: .git/,应该加什么呢?
一般的,过滤隐藏文件:
find . -not -path '*/\.*'
按文件大小排序:
find . -type f | xargs du | sort -rn | head
合起来:
find . -not -path '*/\.*' -type f | xargs du | sort -rn | head
find . -path ./.git -prune -o -type f -exec ls -s {} \; | sort -n -r | head -5