XK0-005 · Question #1776
XK0-005 Question #1776: Real Exam Question with Answer & Explanation
To identify files opened by processes in a specific directory, the lsof command is the most effective tool, as it lists open files and the processes that hold them. Piping its output to grep allows filtering for a specific path.
Question
A Linux systems administrator needs to stop an application and identify which files the application has opened in the /app directory. Which of the following is the best command to use?
Options
- Alsof | grep /app
- Btop | grep /app
- Cps -ef | grep /app
- Dls -o /app | grep open
Explanation
To identify files opened by processes in a specific directory, the lsof command is the most effective tool, as it lists open files and the processes that hold them. Piping its output to grep allows filtering for a specific path.
Common mistakes.
- B. The
topcommand displays process activity in real-time, showing CPU and memory usage, but it does not list files opened by processes. - C. The
ps -efcommand lists all running processes and their full command lines, but it does not directly show which files those processes have open. - D. The
ls -o /appcommand lists directory contents with owner information, but it does not show which files are actively opened by processes.
Concept tested. Identifying open files by process
Reference. https://man7.org/linux/man-pages/man8/lsof.8.html
Topics
Community Discussion
No community discussion yet for this question.