GSEC · Question #316
If a Linux administrator wanted to quickly filter out extraneous data and find a running process named RootKit, which command could he use?
The correct answer is B. ps-ef/ grep Rootkit. The ps -ef command lists all running processes in full format, and piping its output to grep filters for the specific process name, making it the correct tool to quickly locate a named process.
Question
If a Linux administrator wanted to quickly filter out extraneous data and find a running process named RootKit, which command could he use?
Options
- Acat/proc;grep Rootkit
- Bps-ef/ grep Rootkit
- Csed's/Rootkit/g'/var/log/messages
- Dtail/var/log/messages> Rootkit
- Etop-u Rootkit
How the community answered
(32 responses)- A3% (1)
- B75% (24)
- C13% (4)
- D3% (1)
- E6% (2)
Why each option
The ps -ef command lists all running processes in full format, and piping its output to grep filters for the specific process name, making it the correct tool to quickly locate a named process.
cat on the /proc directory is invalid because /proc is a virtual filesystem with subdirectories, not a file that cat can read, and using a semicolon instead of a pipe means grep would search its own stdin rather than the cat output.
The command ps -ef outputs every running process with full details including PID, PPID, and command name, covering all users and sessions. Piping that output to grep RootKit uses standard Unix text filtering to isolate only the lines matching the target process name. This combination is the canonical and fastest method to check whether a specific named process is running on a Linux system.
The sed command shown attempts a text substitution in /var/log/messages, which searches a log file for text rather than inspecting live running processes.
tail /var/log/messages redirects the end of a log file into a file named RootKit rather than searching for a running process.
The top -u flag filters processes by username, not by process name, so top -u RootKit would look for a user account named RootKit, not a process with that name.
Concept tested: Linux process inspection using ps and grep
Source: https://man7.org/linux/man-pages/man1/ps.1.html
Topics
Community Discussion
No community discussion yet for this question.