Explore essential Linux process management concepts with this quiz focusing on commands, signals, and monitoring tools in the Linux ecosystem. Strengthen your understanding of how to interact with and control processes efficiently using core utilities.
Which command displays a real-time, updated list of running processes along with their resource usage on a Linux system?
Explanation: The 'top' command provides a dynamic, real-time view of running processes and their resource usage on Linux. 'ps' shows a static snapshot rather than live updates. 'ping' is used for network testing, not process monitoring. 'pop' is not related to process management, making 'top' the only correct answer for this scenario.
Which command and signal combination is typically used to gracefully terminate a process with process ID 1234?
Explanation: Using 'kill -15' sends the SIGTERM signal, which is a common way to gently ask a process to exit, allowing cleanup. 'kill -9' (SIGKILL) forcefully terminates without cleanup and is less safe. 'kill -1' sends SIGHUP, often used to reload a process. 'kill -0' does not kill the process; it only checks if it's running. Therefore, 'kill -15 1234' is preferred for graceful termination.
How can you determine the parent process ID (PPID) of a process running with process ID 1420?
Explanation: The 'ps -o ppid= -p 1420' command displays only the parent process ID of process 1420. 'ls -l 1420' lists file details and doesn't work for processes. 'grep 1420' searches for the number in files or output, but won't directly show the PPID. 'pwd 1420' is used to print the working directory, not process information. Thus, 'ps -o ppid= -p 1420' is correct.
If you start a script and want to send it to the background after it's running in the foreground, which sequence of keystrokes and command should you use?
Explanation: Pressing 'Ctrl+Z' suspends the foreground process, and running 'bg' resumes it in the background. 'Ctrl+C' stops the process, rather than suspending it. 'Ctrl+X' has no effect on process control in this context, and 'fg' brings a background job to the foreground instead. 'Ctrl+S' can pause terminal output but does not affect process control, and 'kill' ends the process.
What command allows you to monitor new processes as they are created in real time, displaying each new command as it starts?
Explanation: 'watch ps aux' repeatedly runs 'ps aux', letting you observe process changes in near real time. 'pstree -p' shows process hierarchies but does not auto-update as new processes are created. 'pgrep -n' finds the newest matching process but doesn't continuously monitor. 'auditd' is an auditing daemon, which is complex and not specific to live process monitoring like 'watch ps aux.'