XK0-005 · Question #781
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?
To identify which files an application has opened specifically within the /app directory, the lsof command combined with grep is the most effective approach.
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
Why each option
To identify which files an application has opened specifically within the `/app` directory, the `lsof` command combined with `grep` is the most effective approach.
The `top` command displays real-time process statistics and resource usage, but it does not provide information about specific files that processes have opened.
The `ps -ef` command lists all running processes and their details, including command-line arguments, but it does not show which files those processes currently have open.
The `ls -o /app` command lists the contents of the `/app` directory along with ownership information, but it does not indicate which, if any, of those files are currently open by active processes.
Concept tested: Identifying open files by process
Source: https://man7.org/linux/man-pages/man8/lsof.8.html
Topics
Community Discussion
No community discussion yet for this question.