linux查找如何忽略目录

我使用下列语句查找某个目录的大文件:

find . -type f -exec ls -s {} \; | sort -n -r | head -5

但是如果我想排除其中的目录: .git/,应该加什么呢?


aluckdog
浏览 805回答 2
2回答

海绵宝宝撒

find . -path ./.git -prune -o -type f -exec ls -s {} \; | sort -n -r | head -5

慕哥9229398

一般的,过滤隐藏文件:find . -not -path '*/\.*'按文件大小排序:find . -type f  | xargs du | sort -rn | head合起来:find . -not -path '*/\.*' -type f | xargs du | sort -rn | head
打开App,查看更多内容
随时随地看视频慕课网APP