该命令find / -printf ‘%s %p\n’| sort -nr | head -10
返回并显示以下错误:
find: paths must precede expression: %pn'
上面的命令可以在以下位置找到https://www.techrepublic.com/article/how-to-free-disk-space-on-linux-systems/步骤7
我使用的是 CentOS 7。命令type find
返回find is hashed (/usr/bin/find)
。
find
版本如下:
$ find -version
find (GNU findutils) 4.5.11
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION SELINUX FTS(FTS_CWDFD) CBO(level=2)
答案1
您复制的网站错误地使用了印刷引号‘
和’
.您需要使用直引号'
:
find / -printf '%s %p\n' | sort -nr | head -10
如果没有此更改,find
则会收到单独的参数‘%s
和%p\n’
。第一个应用于-printf
,第二个最终成为孤儿并被视为放错位置的路径参数,从而导致您看到错误消息。