An administrator receives a warning about a filesystem filling up, and then identifies a large file located at /tmp/largelogfile.
The administrator deletes the file, but no space is recovered on the filesystem.
Which of the following commands would BEST assists the administrator in identifying the problem?
Click on the arrows to vote for the correct answer
A. B. C. D.A.
https://access.redhat.com/solutions/2316The correct answer to the question is A. lsof | grep largelogfile.
Explanation:
The problem is that the filesystem did not recover space after the large file was deleted. This can happen if the file is still being held open by a running process. In such a case, the file's space will not be freed until the process holding it open is terminated.
The command 'lsof' (list open files) is used to list all open files and the processes that have them open. By piping the output of 'lsof' to the 'grep' command and searching for the filename 'largelogfile', the administrator can identify any process that still has the file open. The 'grep' command filters the output of 'lsof' to show only the lines that contain the filename 'largelogfile'.
The other commands listed are not useful in this scenario:
B. pkill /tmp/largelogfile - This command kills a process by name. However, it does not address the issue of the filesystem not releasing the space used by the deleted file.
C. pgrep largelogfile - This command lists the process IDs of any processes whose name contains the string 'largelogfile'. It does not provide any information about open files.
D. ps "ef | grep largelogfile - This command lists all processes on the system, including their full command line. The command 'ef' is not a valid option for the 'ps' command. The correct option for 'ps' to show all processes is '-e'. The command 'ps -ef' will show all processes, and piping the output to 'grep' can be used to filter for the filename 'largelogfile'. However, this is a more verbose and less efficient way of achieving the same result as the 'lsof' command.