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),並不是用來指定要搜尋的目錄。
