次のコマンドのうち、ユーザーrootが所有する/ tmpディレクトリまたはそのサブディレクトリ内のすべてのファイルとディレクトリを出力するものはどれですか? (2つの正解を選択してください。)
正解:A,C
Explanation
The find command is used to search for files and directories that match certain criteria. The -uid option specifies the numeric user ID of the owner of the file or directory, while the -user option specifies the name of the owner. The -print option prints the full file name of the matching file or directory to the standard output.
Therefore, both find /tmp -uid root -print and find /tmp -user root -print will print all files and directories within the /tmp directory or its subdirectories which are also owned by the user root. The other options are either invalid or do not perform the desired task. The -path option matches the whole path name, not just the starting directory. The -print option is implied if no other action is specified, but it is good practice to include it for clarity. References:
* LPIC-1 Exam 101 Objectives, Topic 103: GNU and Unix Commands, 103.4 Use streams, pipes and
* redirects
* LPIC-1 Linux Administrator 101-500 Exam FAQ, LPIC-1 Exam 101 Objectives, GNU and Unix Commands (Total Weight: 25)