Command-Line

查看完整目錄樹的權限/所有者

  • March 22, 2018

我記得做了類似“XXX /home/user/dir/child/file”之類的事情,它返回了所有者和/或權限:

/home
/home/user
/home/user/dir
/home/user/child
/home/user/child/file

但我不記得這個命令是什麼。有人知道嗎?

該命令可能是:

namei -m /home/user/dir/child/file

我想你可能正在考慮tree命令。例如:

$ tree -pufid apps/glassfish3/ | less
apps/glassfish3
[drwxr-xr-x saml    ]  apps/glassfish3/bin
[drwxr-xr-x saml    ]  apps/glassfish3/glassfish
[drwxr-xr-x saml    ]  apps/glassfish3/glassfish/bin
[drwxr-xr-x saml    ]  apps/glassfish3/glassfish/config
[drwxr-xr-x saml    ]  apps/glassfish3/glassfish/docs
[drwxr-xr-x saml    ]  apps/glassfish3/glassfish/docs/api
[drwxr-xr-x saml    ]  apps/glassfish3/glassfish/docs/api/doc-files
[drwxr-xr-x saml    ]  apps/glassfish3/glassfish/docs/api/javax
[drwxr-xr-x saml    ]  apps/glassfish3/glassfish/docs/api/javax/annotation
[drwxr-xr-x saml    ]  apps/glassfish3/glassfish/docs/api/javax/annotation/security
[drwxr-xr-x saml    ]  apps/glassfish3/glassfish/docs/api/javax/annotation/sql
[drwxr-xr-x saml    ]  apps/glassfish3/glassfish/docs/api/javax/decorator
[drwxr-xr-x saml    ]  apps/glassfish3/glassfish/docs/api/javax/ejb
[drwxr-xr-x saml    ]  apps/glassfish3/glassfish/docs/api/javax/ejb/embeddable
...
...

上述開關執行以下操作:

  • -p- 權限
  • -u- 使用者名/使用者 ID
  • -f- 完整路徑
  • -i- 不列印縮進線
  • -d- 僅列印目錄

參考

引用自:https://unix.stackexchange.com/questions/82361