Which of the following commands prints all files and directories within the /tmp directory or its subdirectories which are also owned by the user root? (Choose TWO correct answers.)
A.
find /tmp -uid root -print
B.
find -path /tmp -uid root
C.
find /tmp -user root -print
D.
find /tmp -user root
E.
find -path /tmp -user root -print
题解
「find」指令可以搜索文件,在这题目中所有选项都使用了「find」指令。
选项 A,「-uid」参数应输入用户的 ID,而不是用户的名称,root 用户的 UID 为 0。
选项 B,「-uid」参数应输入用户的 ID,而不是用户的名称,root 用户的 UID 为 0。
选项 C,正确答案。
选项 D,正确答案。没有指定行为(actions)的话,「-print」参数是预设行为。
选项 E,「-path」参数后面放的是用来比对完整路径的通配符样式(shell pattern),并不是用来指定要搜索的目录。
