nerdexam
CompTIA

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.

Troubleshooting

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.

Alsof | grep /app
Btop | grep /app

The `top` command displays real-time process statistics and resource usage, but it does not provide information about specific files that processes have opened.

Cps -ef | grep /app

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.

Dls -o /app | grep 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

#lsof#file management#process management#command line utilities

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice